編譯器錯誤 C2658
'member': 在匿名結構/union 中重新定義
兩個匿名結構或等位包含具有相同標識碼但具有不同類型的成員宣告。 在 /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;
};
};