For better compatibility with GNU* C++ compiler, the Intel® C++ Compiler for Linux* (9.1 or newer) supports an anonymous union feature.
An anonymous union is a union without a name. An anonymous union is not a type instead it defines an unnamed object.
GNU C++ compiler imposes the same constraints on the fields of nonstandard anonymous unions (which aren't really unions) as on the fields of ordinary (named or unnamed) unions. Our compiler now imposes the same constraints (but the errors are discretionary).
Output of the Intel C++ Compiler:
$ icpc anon_u.cpp anon_u.cpp(13): error #1764: invalid member for anonymous member class -- class "S" has a disallowed member function S s; // Now a discretionary error GCC 4.1 output: $ g++ -Wall -ansi anon_u.cpp anon_u.cpp: In function int main(): anon_u.cpp:13: error: member main()::S main()::N::<anonymous struct>::s with constructor not allowed in anonymous aggregate
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.