Summary: | [DR 178] Aggregate-initialization rejected for class with const data member | ||
---|---|---|---|
Product: | gcc | Reporter: | Daniel Krügler <daniel.kruegler> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fabien, fang, jason, ppluzhnikov |
Priority: | P3 | Keywords: | rejects-valid |
Version: | 4.7.0 | ||
Target Milestone: | 5.0 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | 2.95, 3.0, 4.0.4, 4.6.0, 4.7.0 | Last reconfirmed: | 2011-05-23 22:07:23 |
Description
Daniel Krügler
2011-05-23 21:20:46 UTC
Yes. process_init_constructor_record shouldn't complain about uninitialized const members, because within aggregate initialization, members without explicit initializers are value-initialized. Fabien? It's annoying how GCC bugzilla tends not to send mail to people when I add them to CC even if I also add a comment. Anyway, Fabien, please take a look at this bug. This is a regression relative to 4.5 in C++98/03 mode as well (the a1 declaration). Actually it isn't a regression, it's broken as far back as 2.95. This was clarified to be well-formed as part of DR 178. http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#178 (In reply to comment #2) > It's annoying how GCC bugzilla tends not to send mail to people when I add them > to CC even if I also add a comment. Anyway, Fabien, please take a look at this > bug. GCC bugzilla mails seem to go out in random order with arbitrarily long delays recently, so the "New" bug mail sometimes appears in the archives several minutes after the first comment on a bug. very annoying Mine. Author: paolo Date: Wed Jun 25 14:27:35 2014 New Revision: 211981 URL: https://gcc.gnu.org/viewcvs?rev=211981&root=gcc&view=rev Log: /cp 2014-06-25 Paolo Carlini <paolo.carlini@oracle.com> DR 178 PR c++/49132 * typeck2.c (process_init_constructor_record): Do not complain about uninitialized const members, because within aggregate-initialization, members without explicit initializers are value-initialized. /testsuite 2014-06-25 Paolo Carlini <paolo.carlini@oracle.com> DR 178 PR c++/49132 * g++.dg/cpp0x/aggr1.C: New. * g++.dg/cpp0x/aggr2.C: Likewise. * g++.dg/init/aggr11.C: Likewise. * g++.dg/init/aggr12.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/cpp0x/aggr1.C trunk/gcc/testsuite/g++.dg/cpp0x/aggr2.C trunk/gcc/testsuite/g++.dg/init/aggr11.C trunk/gcc/testsuite/g++.dg/init/aggr12.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/typeck2.c trunk/gcc/testsuite/ChangeLog Fixed for 4.10.0. *** Bug 61581 has been marked as a duplicate of this bug. *** |