From 1ca66f7efec0dd2977b190a11f5ce8642a1e90b2 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 28 Aug 2013 22:40:34 +0000 Subject: [PATCH] re PR c++/58255 ([C++11] explicit delegating constructor with no arguments wrongly rejected) /cp 2013-08-28 Paolo Carlini PR c++/58255 * init.c (build_aggr_init): When init == void_type_node do not set LOOKUP_ONLYCONVERTING. /testsuite 2013-08-28 Paolo Carlini PR c++/58255 * g++.dg/cpp0x/dc7.C: New. From-SVN: r202061 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/dc7.C | 7 +++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/dc7.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da60378b1ad..bf491983ee4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-08-28 Paolo Carlini + + PR c++/58255 + * init.c (build_aggr_init): When init == void_type_node do not + set LOOKUP_ONLYCONVERTING. + 2013-08-27 Caroline Tice * vtable-class-hierarchy.c: Remove unnecessary include statements. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3ec32c580ac..156b4a1e082 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1464,7 +1464,8 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain) TREE_READONLY (exp) = 0; TREE_THIS_VOLATILE (exp) = 0; - if (init && TREE_CODE (init) != TREE_LIST + if (init && init != void_type_node + && TREE_CODE (init) != TREE_LIST && !(TREE_CODE (init) == TARGET_EXPR && TARGET_EXPR_DIRECT_INIT_P (init)) && !(BRACE_ENCLOSED_INITIALIZER_P (init) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4e2daaf6098..afd5eafde32 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-08-28 Paolo Carlini + + PR c++/58255 + * g++.dg/cpp0x/dc7.C: New. + 2013-08-28 Jakub Jelinek PR middle-end/58257 diff --git a/gcc/testsuite/g++.dg/cpp0x/dc7.C b/gcc/testsuite/g++.dg/cpp0x/dc7.C new file mode 100644 index 00000000000..e48741e0713 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/dc7.C @@ -0,0 +1,7 @@ +// PR c++/58255 +// { dg-do compile { target c++11 } } + +struct A { + explicit A() { } + A(int x) : A() { } +}; -- 2.30.2