The following program should not compile. class C { auto union // bad { int a; }; register union // bad { int b; }; static union // bad { int c; }; extern union // bad { int d; }; mutable union // bad { int e; }; };
auto, register, and extern are not normally allowed in classes. static and mutable might be allowed on other members, but not on anonymous unions. See C++ standard clause 9.5/3. -- Summary: Storage classes on anonymous unions in classes Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andrew dot stubbs at st dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32054