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
Created attachment 27161 [details] partial patch This patch fixes the bug, but breaks several other tests in the testsuite, because many places in the compiler assume that if the constructor isn't callable, it's also non-trivial. This needs to be fixed, but for the moment I'm going to look at lower-hanging fruit.
This is fixed in mainline. I'm adding the testcase and closing the bug.
Author: paolo Date: Mon Dec 9 09:50:51 2013 New Revision: 205801 URL: http://gcc.gnu.org/viewcvs?rev=205801&root=gcc&view=rev Log: 2013-12-09 Paolo Carlini <paolo.carlini@oracle.com> PR c++/52707 * g++.dg/cpp0x/deleted2.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/deleted2.C Modified: trunk/gcc/testsuite/ChangeLog
Done.