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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.