编译器错误 C2658
“member”: 匿名结构/联合中的重定义
两个匿名结构或联合包含具有相同标识符但不同类型的成员声明。 在 /Za 下,对于具有相同标识符和类型的成员,你也会收到此错误。
以下示例生成 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;
};
};