From: Jason Merrill Date: Tue, 29 Aug 2017 19:39:18 +0000 (-0400) Subject: Fix default argument conversion failure and SFINAE. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1aeafba210c4796bde79d4d06e05c96a153b8fb5;p=gcc.git Fix default argument conversion failure and SFINAE. * call.c (build_over_call): Check convert_default_arg result for error_mark_node. * parser.c (cp_parser_late_parsing_default_args): Remember error_mark_node. From-SVN: r251421 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 37ae6ea17c0..fc244a13803 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2017-08-29 Jason Merrill + + Fix default argument conversion failure and SFINAE. + * call.c (build_over_call): Check convert_default_arg result for + error_mark_node. + * parser.c (cp_parser_late_parsing_default_args): Remember + error_mark_node. + 2017-08-28 Nathan Sidwell * cp-tree.h (lang_type): Replace sorted_fields vector with diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 067db59ae2c..6405be2d480 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7892,10 +7892,13 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) { if (TREE_VALUE (parm) == error_mark_node) return error_mark_node; - argarray[j++] = convert_default_arg (TREE_VALUE (parm), - TREE_PURPOSE (parm), - fn, i - is_method, - complain); + val = convert_default_arg (TREE_VALUE (parm), + TREE_PURPOSE (parm), + fn, i - is_method, + complain); + if (val == error_mark_node) + return error_mark_node; + argarray[j++] = val; } /* Ellipsis */ diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b849824fcd0..9b7c2c0dd6e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -27645,11 +27645,6 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) = cp_parser_late_parse_one_default_arg (parser, parmdecl, default_arg, TREE_VALUE (parm)); - if (parsed_arg == error_mark_node) - { - continue; - } - TREE_PURPOSE (parm) = parsed_arg; /* Update any instantiations we've already created. */ diff --git a/gcc/testsuite/g++.dg/ext/is_constructible1.C b/gcc/testsuite/g++.dg/ext/is_constructible1.C new file mode 100644 index 00000000000..b80ac28e725 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_constructible1.C @@ -0,0 +1,6 @@ +// { dg-do compile { target c++11 } } +// { dg-options "" } + +template struct Foo { Foo(T = nullptr) {} }; + +static_assert (!__is_constructible(Foo)); diff --git a/gcc/testsuite/g++.dg/other/new1.C b/gcc/testsuite/g++.dg/other/new1.C index 71383706ea4..30b651326aa 100644 --- a/gcc/testsuite/g++.dg/other/new1.C +++ b/gcc/testsuite/g++.dg/other/new1.C @@ -10,5 +10,5 @@ struct A void foo() { - new A; // { dg-error "default argument" } + new A; } diff --git a/gcc/testsuite/g++.dg/parse/crash40.C b/gcc/testsuite/g++.dg/parse/crash40.C index df352dd7db5..537cdb78ef1 100644 --- a/gcc/testsuite/g++.dg/parse/crash40.C +++ b/gcc/testsuite/g++.dg/parse/crash40.C @@ -37,6 +37,6 @@ void bar() int i; i.C::foo<0>(); /* { dg-error "which is of non-class type" } */ - S s; /* { dg-error "default argument" } */ + S s; SS ss; } diff --git a/gcc/testsuite/g++.dg/parse/defarg12.C b/gcc/testsuite/g++.dg/parse/defarg12.C index 2d2d7e7a06a..df805813897 100644 --- a/gcc/testsuite/g++.dg/parse/defarg12.C +++ b/gcc/testsuite/g++.dg/parse/defarg12.C @@ -9,5 +9,5 @@ struct A void foo() { - A().i; /* { dg-error "default argument" } */ + A().i; } diff --git a/gcc/testsuite/g++.dg/template/error15.C b/gcc/testsuite/g++.dg/template/error15.C index 86936581cfd..ad18a1b3f9a 100644 --- a/gcc/testsuite/g++.dg/template/error15.C +++ b/gcc/testsuite/g++.dg/template/error15.C @@ -18,7 +18,7 @@ protected: template void B::g(void) { - f(); // { dg-error "default argument" } + f(); } template class B;