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++/61489] Wrong warning with -Wmissing-field-initializers.


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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Deniz Bahadir from comment #3)
> Thanks for the comment.
> 
> So, at least we aggree that the cases for addr2 and addr6 should not warn
> (in C++11) as it initializes all values.

No, that's not why I said it should not warn. All your examples except addr0
initialize all values, that's not the point. Please read the fine manual, the
warning is explicitly documented to warn when some members are implicitly set
to zero.

The warning is NOT designed to tell you about uninitialized members. It is
designed to tell you about implicitly zero-initialized members. So please stop
claiming it shouldn't warn when all members are zero-initialized, that's
EXACTLY what the warning is for.

(I think {} should not warn in C++11 because it is similar to the addr5 case,
which is explicit value-initialization. Although technically your cases are
still aggregate-initialization not value-initialization even with {})


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