aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2023-03-14 16:32:31 -0400
committerJason Merrill <jason@redhat.com>2023-03-14 18:09:52 -0400
commit9e44a9932c11f028269f3aa7e3031e703d151b0b (patch)
treea2010eae9ce1eb120ff3a0c8f46503fa951e0eb4 /gcc/cp
parent2b204accd07a3185b58b1edc6e9b019472857a5d (diff)
downloadgcc-9e44a9932c11f028269f3aa7e3031e703d151b0b.zip
gcc-9e44a9932c11f028269f3aa7e3031e703d151b0b.tar.gz
gcc-9e44a9932c11f028269f3aa7e3031e703d151b0b.tar.bz2
c++: variable tmpl partial specialization [PR108468]
Generally we expect TPARMS_PRIMARY_TEMPLATE to be set, but sometimes it isn't for partial instantiations. This ought to be improved, but it's trivial to work around it in this case. PR c++/108468 gcc/cp/ChangeLog: * pt.cc (unify_pack_expansion): Check that TPARMS_PRIMARY_TEMPLATE is non-null. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/var-templ78.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/pt.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 65341c4..c53d8e2 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -24148,6 +24148,8 @@ unify_pack_expansion (tree tparms, tree targs, tree packed_parms,
arguments if it is not otherwise deduced. */
if (cxx_dialect >= cxx20
&& TREE_VEC_LENGTH (new_args) < TREE_VEC_LENGTH (old_args)
+ /* FIXME This isn't set properly for partial instantiations. */
+ && TPARMS_PRIMARY_TEMPLATE (tparms)
&& builtin_guide_p (TPARMS_PRIMARY_TEMPLATE (tparms)))
TREE_VEC_LENGTH (old_args) = TREE_VEC_LENGTH (new_args);
if (!comp_template_args (old_args, new_args,