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.
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,
--- /dev/null
+// PR c++/108468
+// { dg-do compile { target c++14 } }
+
+template<int> struct C {
+ template<class, class>
+ static constexpr int x = 1;
+};
+
+template<int I> template<class... A>
+int C<I>::x<void(A...), void(A...)> = 2;
+
+int y = C<0>::x<void(int), void()>;