Initializers for unnamed bitfields

Neil Booth neil@daikokuya.demon.co.uk
Sat Jan 26 14:58:00 GMT 2002


GCC seems to ignore unnamed bitfields when initializing structures
with a brace-enclosed list.  Is this correct?  By my reading of the
standard, it's a bug.

struct test
{
  int : 8;
  int a:8;
};

struct test c = {5, 5};

$  gcc /tmp/foo.c -c
/tmp/foo.c:7: warning: excess elements in struct initializer
/tmp/foo.c:7: warning: (near initialization for `c')

Neil.



More information about the Gcc-bugs mailing list