[Bug c++/49132] New: [C++0x] Aggregate-initialization rejected for class with const data member
daniel.kruegler at googlemail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 23 21:46:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49132
Summary: [C++0x] Aggregate-initialization rejected for class
with const data member
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
CC: jason@redhat.com
gcc 4.7.0 20110521 (experimental) in C++0x mode rejects the following code:
//---
struct A {
const int m;
};
A a1 = {}; // #1
A a2{}; // #2
//---
The error messages at the lines marked with #1 and #2 are:
"error: uninitialized const member 'A::m'"
The code should be accepted, because the objects undergo
aggregate-initialization. The error message is incorrect, the objects are
initialized.
More information about the Gcc-bugs
mailing list