c++: Fix Bases(args...)... base initialization [PR88580]
authorPatrick Palka <ppalka@redhat.com>
Tue, 27 Apr 2021 18:18:25 +0000 (14:18 -0400)
committerPatrick Palka <ppalka@redhat.com>
Tue, 27 Apr 2021 18:18:25 +0000 (14:18 -0400)
commit37d2b98100cefcb9d312d379473c12aa6d61fc62
tree49b2e2ad017d1b3dcba89fcc2a1356a9c7b42dc7
parent85ef4b8d4eb3313a48b79c7e752891f9646bb246
c++: Fix Bases(args...)... base initialization [PR88580]

When substituting into the arguments of a base initializer pack
expansion, tsubst_initializer_list uses a dummy EXPR_PACK_EXPANSION
in order to expand an initializer such as Bases(args)... into
Bases#{0}(args#{0}) and so on.  But when an argument inside the base
initializer is itself a pack expansion, as in Bases(args...)..., the
argument is already an EXPR_PACK_EXPANSION so we don't need to wrap it.
It's also independent from the outer expansion of Bases, so we need to
"multiplicatively" append the expansion of args... onto the argument
list of each expanded base.

gcc/cp/ChangeLog:

PR c++/88580
* pt.c (tsubst_initializer_list): Correctly handle the case
where an argument inside a base initializer pack expansion is
itself a pack expansion.

gcc/testsuite/ChangeLog:

PR c++/88580
* g++.dg/cpp0x/variadic182.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic182.C [new file with mode: 0644]