This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: initialising anonymous unions


David Howells wrote:
dhowells>gcc -s union.c union.c:15: unknown field `x' specified in initializer

I suggest submitting a bug report into the FSF gcc bugzilla database if you haven't already.


This looks like a case where the GCC extension for anonymous unions doesn't support the ISO C99 syntax for initializing structures. This is a common problem with GCC extensions, they don't always interact well with other language features. It looks like this probably should work, but it would be useful to check other compilers for precedent either way.

You can work around this problem by adding braces around the initializer for .x. However, this is only useful if you have a fully bracketed in-order initializer, which defeats the purpose of using named initializers.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]