Compartilhar via


Erro do compilador C2658

'membro': redefinição em struct/union anônimo

Duas estruturas anônimas ou sindicatos continham declarações de membro com o mesmo identificador, mas com tipos diferentes. Em /Za, você também receberá esse erro para membros com o mesmo identificador e tipo.

O seguinte exemplo gera o erro C2658:

// C2658.cpp
// compile with: /c
struct X {
   union { // can be struct too
      int i;
   };
   union {
      int i;   // Under /Za, C2658
      // int i not needed here because it is defined in the first union
   };
};

struct Z {
   union {
      char *i;
   };

   union {
      void *i;   // C2658 redefinition of 'i'
      // try the following line instead
      // void *ii;
   };
};