Not sure if this is a bug or a standards interpretation issue. Consider the following union, whose first member is an anonymous struct: union Foo { struct { float a,b,c; }; const char* x; }; icc (10.1) permits initialization of the first member of the union: Foo foo = { .0f, .0f, .0f }; gcc (4.0.1) doesn't permit that, but does permit the following, which I believe should not be accepted: Foo foo = { "foo" };
4.0 branch is closed. Gcc 4.1.2 gave [hjl@gnu-3 tmp]$ cat u.cc union Foo { struct { float a,b,c; }; const char* x; }; Foo foo = { .0f, .0f, .0f }; Foo foo1 = { "foo" }; [hjl@gnu-3 tmp]$ gcc -c u.cc u.cc:7: error: cannot convert ‘const char*’ to ‘float’ in initialization [hjl@gnu-3 tmp]$