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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2026-01-07
     Ever confirmed|0                           |1

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to GCC Commits from comment #8)
>     The manual is incorrect in saying that the option does not warn
>     about designated initializers, which it does in C++.  Whether the
>     divergence in behavior is desirable is another thing, but let's
>     at least make the manual match the reality.

I think it's not desirable, I think the C front-end gets this right. So
confirmed.

To summarize, C does not warn here, and C++ does:

struct S { int i; int j; };
struct S s = { .i = 1 };

dinit.cc:2:23: warning: missing initializer for member 'S::j'
[-Wmissing-field-initializers]
    2 | struct S s = { .i = 1 };
      |                       ^

Reply via email to