{
/* Make a copy of the extra arguments so that they won't get changed
out from under us. */
- tree extra = copy_template_args (args);
+ tree extra = preserve_args (copy_template_args (args), /*cow_p=*/false);
if (local_specializations)
if (tree locals = extract_local_specs (pattern, complain))
extra = tree_cons (NULL_TREE, extra, locals);
--- /dev/null
+// PR c++/103105
+// { dg-do compile { target c++20 } }
+
+template<bool> struct A;
+
+template<class... Ts>
+using wrap = A<1 != (0 + ... + requires { Ts(); })>;
+
+template<class... Ts> using type = wrap<Ts...>;
+
+using ty0 = type<>;
+using ty0 = A<true>;
+
+using ty1 = type<int>;
+using ty1 = A<false>;
+
+using ty2 = type<int, int>;
+using ty2 = A<true>;
--- /dev/null
+// PR c++/103105
+// { dg-do compile { target c++20 } }
+
+template<class...> struct list;
+
+template<bool> struct A;
+
+template<class T, class... Ts>
+using wrap = A<1 != (0 + ... + requires { T() = Ts(); })>;
+
+template<class... Ts> using type = list<wrap<Ts, Ts...>...>;
+
+using ty0 = type<>;
+using ty0 = list<>;
+
+using ty1 = type<int>;
+using ty1 = list<A<true>>;
+
+using ty2 = type<int, int>;
+using ty2 = list<A<true>, A<true>>;
+
+using ty3 = type<int, int, int>;
+using ty3 = list<A<true>, A<true>, A<true>>;