This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80454] -Wmissing-braces wrongly warns about universal zero initializer {0}
- From: "amonakov at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 10:48:05 +0000
- Subject: [Bug c/80454] -Wmissing-braces wrongly warns about universal zero initializer {0}
- Auto-submitted: auto-generated
- References: <bug-80454-4@http.gcc.gnu.org/bugzilla/>
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};