Google ref: b/10458361 Test: struct A { explicit A() { } // remove explicit -> compiles fine A(int x) : A() { } }; Builds with Clang. Fails using g++ (GCC) 4.9.0 20130827 (experimental): g++ -c -std=c++11 /tmp/t1.cc -o /tmp/t.o /tmp/t1.cc: In constructor 'A::A(int)': /tmp/t1.cc:3:16: error: no matching function for call to 'A::A()' A(int x) : A() { } ^ /tmp/t1.cc:3:16: note: candidates are: /tmp/t1.cc:3:3: note: A::A(int) A(int x) : A() { } ^ /tmp/t1.cc:3:3: note: candidate expects 1 argument, 0 provided /tmp/t1.cc:1:8: note: constexpr A::A(const A&) struct A { ^ /tmp/t1.cc:1:8: note: candidate expects 1 argument, 0 provided /tmp/t1.cc:1:8: note: constexpr A::A(A&&) /tmp/t1.cc:1:8: note: candidate expects 1 argument, 0 provided This has been broken since at least gcc-4.7
Seems easy.
I'm finishing testing this: Index: init.c =================================================================== --- init.c (revision 202020) +++ init.c (working copy) @@ -1465,6 +1465,7 @@ build_aggr_init (tree exp, tree init, int flags, t TREE_THIS_VOLATILE (exp) = 0; if (init && TREE_CODE (init) != TREE_LIST + && init != void_type_node && !(TREE_CODE (init) == TARGET_EXPR && TARGET_EXPR_DIRECT_INIT_P (init)) && !(BRACE_ENCLOSED_INITIALIZER_P (init)
Author: paolo Date: Wed Aug 28 22:40:34 2013 New Revision: 202061 URL: http://gcc.gnu.org/viewcvs?rev=202061&root=gcc&view=rev Log: /cp 2013-08-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58255 * init.c (build_aggr_init): When init == void_type_node do not set LOOKUP_ONLYCONVERTING. /testsuite 2013-08-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58255 * g++.dg/cpp0x/dc7.C: New. Added: trunk/gcc/testsuite/g++.dg/cpp0x/dc7.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/init.c trunk/gcc/testsuite/ChangeLog
Fixed for 4.9.0.