This is the mail archive of the gcc-bugs@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]

[Bug c/30006] Compound literal in structure initializer causes missing initializer warning to happen



------- Comment #2 from he at uninett dot no  2008-06-06 09:50 -------
Hi,

here is another testcase which I think might have the
same or at least a similar root cause:

struct o {
        struct n {
                int b;
                int a;
        } n;
};

const struct o o = {
#ifdef BUG
        .n.b = 1
#else
        .n = { .b = 1 }
#endif
};

When compiled with "-c -Wextra" with gcc 4.1.3 as found in NetBSD-current,
this will complain about missing initializers if BUG is defined, even though
a C99-style initializer is used, something which I thought should have obviated 
the insistence on initializing all the fields of the struct.


-- 

he at uninett dot no changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |he at uninett dot no


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30006


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