http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707
Bug #: 52707
Summary: [C++11] Deleted special member function prevent type
being an aggregate
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
gcc 4.8.0 20120318 (experimental) in C++11 mode rejects the following code:
//---
struct A {
int m;
A() = delete;
};
A a = {1}; // line 6
//---
"6|error: could not convert '{1}' from '<brace-enclosed initializer list>' to
'A'|"
But according to N3290 (N3376 still the same) the user-declared, deleted
default-constructor should not prevent A from being an aggregate type and
aggregate initialization should happen here. The error text implies that A is
considered as a non-aggregate and no feasible constructor is found.
According to 8.4.2 p4:
"A function is user-provided if it is user-declared and not explicitly
defaulted or deleted on its first declaration."
and by 8.5.1 p1:
"An aggregate is [..] a class (Clause 9) with no user-provided constructors"
Thus, the deleted default constructor is not a user-provided constructor and
aggregate initialization should work.
This is due to DR 1135 which is already part of C++11:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1135