diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 65341c40f97036a034ead6a6b3aba949ed554b4c..c53d8e279c62cf35bc71dd12f44ded5ba3393fe0 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, diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ78.C b/gcc/testsuite/g++.dg/cpp1y/var-templ78.C new file mode 100644 index 0000000000000000000000000000000000000000..48366c927751cf782f84fd635ef21fba06bde35c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ78.C @@ -0,0 +1,12 @@ +// 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()>;