diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-01-17 18:07:53 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2018-01-17 18:07:53 +0000 |
commit | 9a41cc05e50db044d59d6dce6fb10c94bc591d8a (patch) | |
tree | 4f6d92afac30088b9491326a556d30bb214b53eb | |
parent | e1afa6615f79c8ed214271040ab48e6db72be408 (diff) |
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/branches/gcc-7-branch@256807 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/nontype-auto13.C | 18 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bbe31ec76931..a041f355e40e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2018-01-17 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. + PR c++/82760 - memory corruption with aligned new. * call.c (build_operator_new_call): Update *args if we add the align_arg. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 61fe2a3a14db..9b5c35b4a21b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20686,7 +20686,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 <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); } |