tree expanded_exprs;
/* Expand the argument. */
- SET_PACK_EXPANSION_PATTERN (expr, TREE_VALUE (arg));
+ tree value;
+ if (TREE_CODE (TREE_VALUE (arg)) == EXPR_PACK_EXPANSION)
+ value = TREE_VALUE (arg);
+ else
+ {
+ value = expr;
+ SET_PACK_EXPANSION_PATTERN (value, TREE_VALUE (arg));
+ }
expanded_exprs
- = tsubst_pack_expansion (expr, argvec,
+ = tsubst_pack_expansion (value, argvec,
tf_warning_or_error,
NULL_TREE);
if (expanded_exprs == error_mark_node)
/* Prepend each of the expanded expressions to the
corresponding TREE_LIST in EXPANDED_ARGUMENTS. */
for (i = 0; i < len; i++)
- {
- TREE_VEC_ELT (expanded_arguments, i) =
- tree_cons (NULL_TREE,
- TREE_VEC_ELT (expanded_exprs, i),
- TREE_VEC_ELT (expanded_arguments, i));
- }
+ if (TREE_CODE (TREE_VALUE (arg)) == EXPR_PACK_EXPANSION)
+ for (int j = 0; j < TREE_VEC_LENGTH (expanded_exprs); j++)
+ TREE_VEC_ELT (expanded_arguments, i)
+ = tree_cons (NULL_TREE,
+ TREE_VEC_ELT (expanded_exprs, j),
+ TREE_VEC_ELT (expanded_arguments, i));
+ else
+ TREE_VEC_ELT (expanded_arguments, i)
+ = tree_cons (NULL_TREE,
+ TREE_VEC_ELT (expanded_exprs, i),
+ TREE_VEC_ELT (expanded_arguments, i));
}
in_base_initializer = 0;
--- /dev/null
+// PR c++/88580
+// { dg-do compile { target c++11 } }
+
+template <class... Bases>
+struct Derived : Bases... {
+ template <class... Ts>
+ Derived(Ts... args) : Bases(args, args..., args)... { }
+};
+
+struct A { };
+struct B { };
+struct C { };
+
+struct Base1 { Base1(A, A, B, C, A); };
+struct Base2 { Base2(B, A, B, C, B); };
+struct Base3 { Base3(C, A, B, C, C); };
+
+Derived<Base1, Base2, Base3> d(A{}, B{}, C{});