The manual: http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html
states that the compiler gives an error for constructs which are ambigious. However I could not produce this error, even using the example on that page: struct { int a; struct { int a; }; } foo; I was first made aware of this with a structure like the following. This also does not produce any compiler error, either at definition or where member variables are used: union { int a; struct { int x; int a; }; } bar; Instead, where 'a' is used, the first definition is seen to be used, silently with no error or warning. This is more serious, because use of x overwrites a. Test platform is GCC 4.5.0 (Arch Linux), building with -Wall. Also verified on GCC 4.3.3 (Slackware Linux) vega$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: ../configure --prefix=/usr --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object --enable-lto --enable-plugin --disable-multilib --disable-libstdcxx-pch --with-system-zlib --with-ppl --with-cloog --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info Thread model: posix gcc version 4.5.0 20100610 (prerelease) (GCC) -- Summary: Ambiguous member names in anonymous struct/union does not error Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mark-gcc at pogo dot org dot uk GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44692