Created attachment 372842 [details] Reproducer Description of problem: If you try to use a struct with an unnamed union field, for example: struct foo { int bar; union { int baz; int bam; }; }; And then try to statically initialize one using field labels like so: struct foo mine = { .bar = 1, .baz = 2 }; you get: error: unknown field ‘baz’ specified in initializer Version-Release number of selected component (if applicable): gcc-4.4.2-7.fc12 Steps to Reproduce: Try compiling the attached program. Actual results: reproducer.c:13: error: unknown field ‘baz’ specified in initializer Expected results: Compiles. mine.bar == 1, mine.baz == mine.bam == 2
Why do you think it is a bug? ISO C99 designated initializers require that the identifier identifies a field in the current structure/union, which is not the case.