[Bug c++/55805] Empty brace-init-list causes warning "missing initializer for member" in C++11
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 16 11:43:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55805
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Gubbins from comment #5)
> The warning is still produced with gcc 4.9.2 (surely that's supported?)
The warning isn't given for 5.1 and trunk (not sure what I tested before).
(In reply to Gubbins from comment #6)
> It's clear that A is an aggregate type, but it is also a class type with a
> default constructor. Doesn't the quoted section of the C++11 specification
> therefore state that the object should be value-initialized?
Nope.
8.5.4 says:
— Otherwise, if T is an aggregate, aggregate initialization is performed
(8.5.1).
— Otherwise, if the initializer list has no elements and T is a class type with
a default constructor, the object is value-initialized. The C++11 wording was
fixed by a defect report, see
http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1301
(In reply to Gubbins from comment #7)
> Anyway, even if this is classified as aggregate initialization (which I
> believe it is in C++14?), I believe the behaviour should be changed.
It already has been for gcc-5.
More information about the Gcc-bugs
mailing list