This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54835] New: [C++11] Explicit default constructors not respected during copy-list-initialization
- From: "daniel.kruegler at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 06 Oct 2012 11:20:07 +0000
- Subject: [Bug c++/54835] New: [C++11] Explicit default constructors not respected during copy-list-initialization
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54835
Bug #: 54835
Summary: [C++11] Explicit default constructors not respected
during copy-list-initialization
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: daniel.kruegler@googlemail.com
gcc 4.8.0 20120930 (experimental) with the compiler flags
-Wall -pedantic -std=c++11
accepts the following copy-list-initialization of a class type with an explicit
default constructor:
//-------------------------
struct S {
explicit S(int = 0) {}
};
S s = {};
//-------------------------
This code should be ill-formed, because it is ruled out by [over.match.list],
in particular by the unconditional wording:
"In copy-list-initialization, if an explicit constructor is chosen, the
initialization is ill-formed."