共用方式為


編譯器錯誤 C2646

位於全域或命名空間範圍的匿名結構或等位必須宣告為 static

位於全域或命名空間範圍但未宣告為 static 的匿名結構或等位。

下列範例會產生 C2646,並示範如何修正此問題。

// C2646.cpp
// compile with: /c
union { int i; };   // C2646 not static

// OK
static union { int j; };
union U { int i; };