]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: argument pack with expansion [PR86355]
authorJason Merrill <jason@redhat.com>
Wed, 26 May 2021 21:38:42 +0000 (17:38 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 9 Jul 2021 20:14:13 +0000 (16:14 -0400)
commit542d90bfd802274f38637aaaffc2dd1de62c9ec6
treeedb897d82db523b02310670e2b137c50e9b40f2b
parente6c7e45bfdd2b910e9001f3e27ebb86062d96534
c++: argument pack with expansion [PR86355]

This testcase revealed that we were using PACK_EXPANSION_EXTRA_ARGS a lot
more than necessary; use_pack_expansion_extra_args_p meant to use it in the
case of corresponding arguments in different argument packs differing in
whether they are pack expansions, but it was mistakenly also returning true
for the case of a single argument pack containing both expansion and
non-expansion elements.

Surprisingly, just disabling that didn't lead to any regressions in the
testsuite; it seems other changes have prevented us getting to this point
for code that used to exercise it.  So this patch limits the check to
arguments in the same position in the packs, and asserts that we never
actually see a mismatch.

PR c++/86355

gcc/cp/ChangeLog:

* pt.c (use_pack_expansion_extra_args_p): Don't compare
args from the same argument pack.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/alias-decl-variadic2.C: New test.
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/alias-decl-variadic2.C [new file with mode: 0644]