From: Jason Merrill Date: Fri, 2 Mar 2018 18:24:40 +0000 (-0500) Subject: PR c++/84489 - dependent default template argument X-Git-Tag: releases/gcc-6.5.0~491 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27664bbdeab6f5ced2c0fa58555da5ae060feeb6;p=thirdparty%2Fgcc.git PR c++/84489 - dependent default template argument * pt.c (type_unification_real): Handle early substitution failure. From-SVN: r258152 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d30784fbf156..ab5a911f44ff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-03-02 Jason Merrill + + PR c++/84489 - dependent default template argument + * pt.c (type_unification_real): Handle early substitution failure. + 2018-02-28 Jason Merrill PR c++/71784 - ICE with ref-qualifier and explicit specialization. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9dbf17ba4d88..27e4c84ac799 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18603,10 +18603,10 @@ type_unification_real (tree tparms, if (DECL_P (parm)) input_location = DECL_SOURCE_LOCATION (parm); arg = tsubst_template_arg (arg, targs, complain, NULL_TREE); - if (!uses_template_parms (arg)) + if (arg != error_mark_node && !uses_template_parms (arg)) arg = convert_template_argument (parm, arg, targs, complain, i, NULL_TREE); - else if (saw_undeduced < 2) + else if (saw_undeduced == 1) arg = NULL_TREE; else arg = error_mark_node; diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C new file mode 100644 index 000000000000..636bf1afd883 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg7.C @@ -0,0 +1,10 @@ +// PR c++/84489 +// { dg-do compile { target c++11 } } + +template > 1)> +T f1() {return 0;} + +int main() +{ + f1(); // Bug here +}