NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2658

'member': redefinition in anonymous struct/union

Two anonymous structures or unions contained member declarations with the same identifier but with different types. Under /Za, you will also get this error for members with the same identifier and type.

The following sample generates C2658:

struct X {
   union { // can be struct too
      int i;
   };
   union {
      int i; // C2658 with /Za; ignored silently otherwise
      // 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
      // void *ii;
   };
};

void main() {
}