c++: ICE with unexpanded pack in do-while [PR99063]
authorMarek Polacek <polacek@redhat.com>
Thu, 11 Feb 2021 03:51:30 +0000 (22:51 -0500)
committerMarek Polacek <polacek@redhat.com>
Thu, 11 Feb 2021 16:12:49 +0000 (11:12 -0500)
commitf0da1c0cb7661ee9111bc475efddae80a026de34
tree7920ddc5775bb5acdb6ec0552845ca8032c3d56a
parentcb168f779c87c1e0c37d22ea82dfb93ff8c873bc
c++: ICE with unexpanded pack in do-while [PR99063]

Here an unexpanded parameter pack snuck into prep_operand which doesn't
expect to see an operand without a type, and since r247842
NONTYPE_ARGUMENT_PACK doesn't have a type anymore.

This only happens with the do-while loop whose condition may not
contain a declaration so we never called finish_cond which checks
for unexpanded parameter packs.  So use check_for_bare_parameter_packs
to remedy that.

gcc/cp/ChangeLog:

PR c++/99063
* semantics.c (finish_do_stmt): Check for unexpanded parameter packs.

gcc/testsuite/ChangeLog:

PR c++/99063
* g++.dg/cpp0x/variadic-crash6.C: New test.
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp0x/variadic-crash6.C [new file with mode: 0644]