This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: initialising anonymous unions
- From: Jim Wilson <wilson at specifixinc dot com>
- To: David Howells <dhowells at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 26 Oct 2003 18:41:01 -0800
- Subject: Re: initialising anonymous unions
- References: <11138.1066386377@redhat.com>
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