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/80454] -Wmissing-braces wrongly warns about universal zero initializer {0}


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80454

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
The bug is that universal zero initializers are warned about when they are
inside of some other initializer, even though we correctly stopped doing that
when they appear on their own. In the following example GCC shouldn't warn for
the initialization of s2, like it already doesn't for s1 (Clang warns for both,
but that's probably a bug in Clang).

struct S1 {
    struct S1i {
        int i;
    } s1i;
    int i;
};

#define S1_INIT {0}

struct S1 s1 = S1_INIT;

struct S2 {
    struct S1 s1;
    int i;
} s2 = {S1_INIT, 0};

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