From: jason Date: Tue, 5 Dec 2017 18:05:23 +0000 (+0000) Subject: PR c++/82331 - ICE with variadic partial specialization of auto X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3ead9ac3088b2a39a14973c730d2b56718618acf;p=thirdparty%2Fgcc.git PR c++/82331 - ICE with variadic partial specialization of auto * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl around call to tsubst. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255430 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d5141f038473..122045b35358 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-12-05 Jason Merrill + + PR c++/82331 - ICE with variadic partial specialization of auto + * pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl + around call to tsubst. + 2017-12-05 Nathan Sidwell PR c++/83287 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 500ac0c64fee..685f34a735d4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20942,7 +20942,9 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, template-parameter exactly, except that a template-argument deduced from an array bound may be of any integral type. The non-type parameter might use already deduced type parameters. */ + ++processing_template_decl; tparm = tsubst (TREE_TYPE (parm), targs, 0, NULL_TREE); + --processing_template_decl; if (tree a = type_uses_auto (tparm)) { tparm = do_auto_deduction (tparm, arg, a, complain, adc_unify); diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C new file mode 100644 index 000000000000..2152cef811ec --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C @@ -0,0 +1,18 @@ +// PR c++/82331 +// { dg-options -std=c++17 } + +template +class X; + +template +class X { +public: + static R call (A... args) + { + return (*F)(args...); + } +}; + +int func (int a, int b) { return a + b; } + +int test () { return X<&func>::call(1, 2); }