From a8a3f32d583d9fde8e94c11c118c47c702bdea04 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 26 Feb 2018 00:05:15 -0500 Subject: [PATCH] PR c++/84015 - ICE with class deduction and auto template parm. * pt.c (rewrite_template_parm): Use tf_partial in first tsubst. From-SVN: r257979 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 2 +- gcc/testsuite/g++.dg/cpp1z/class-deduction49.C | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1z/class-deduction49.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d4c946ad16..cb0dcd7c43e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-02-25 Jason Merrill + + PR c++/84015 - ICE with class deduction and auto template parm. + * pt.c (rewrite_template_parm): Use tf_partial in first tsubst. + 2018-02-24 Marek Polacek PR c++/83692 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 85d1adbbe3c..9cf96e9fbe4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25596,7 +25596,7 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level, // Substitute ttargs into ttparms to fix references to // other template parameters. ttparms = tsubst_template_parms_level (ttparms, ttargs, - complain); + complain|tf_partial); // Now substitute again with args based on tparms, to reduce // the level of the ttparms. ttargs = current_template_args (); diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C new file mode 100644 index 00000000000..086f12ad3c6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C @@ -0,0 +1,15 @@ +// PR c++/84015 +// { dg-additional-options -std=c++17 } + +template +struct A { }; + +template +struct B +{ + templateclass T> + B(T); +}; + +A<42> a; +B b (a); -- 2.30.2