diff options
author | Jason Merrill <jason@redhat.com> | 2017-12-05 13:05:23 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-12-05 13:05:23 -0500 |
commit | 53943619eb92811e82c3e0917c675ee709fbfe2a (patch) | |
tree | affb0e2772b1c6668f7630c51679cf72c17efead | |
parent | ea9e71de65fd640620938a463d30408f92fea8d1 (diff) | |
download | gcc-53943619eb92811e82c3e0917c675ee709fbfe2a.zip gcc-53943619eb92811e82c3e0917c675ee709fbfe2a.tar.gz gcc-53943619eb92811e82c3e0917c675ee709fbfe2a.tar.bz2 |
PR c++/82331 - ICE with variadic partial specialization of auto
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
around call to tsubst.
From-SVN: r255430
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C | 18 |
3 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d5141f0..122045b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-12-05 Jason Merrill <jason@redhat.com> + + 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 <nathan@acm.org> PR c++/83287 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 500ac0c..685f34a 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 0000000..2152cef --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C @@ -0,0 +1,18 @@ +// PR c++/82331 +// { dg-options -std=c++17 } + +template <auto> +class X; + +template <typename R, typename... A, R (*F) (A...)> +class X<F> { +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); } |