c++: Fix constexpr if and braced functional cast.
authorJason Merrill <jason@redhat.com>
Mon, 10 Feb 2020 13:12:07 +0000 (14:12 +0100)
committerJason Merrill <jason@redhat.com>
Wed, 12 Feb 2020 23:43:22 +0000 (00:43 +0100)
commitc2368db567a853b0765833b3bd4e7934f3c6be61
treecafcb81e34026f059e57589f94c12142ae353a80
parent68bb7e3b9dc3be6c9ceecc2c87b9c678e1a045dc
c++: Fix constexpr if and braced functional cast.

While partially instantiating a generic lambda, we can encounter pack
expansions or constexpr if where we can't actually do the substitution
immediately, and instead remember a partial instantiation context
in *_EXTRA_ARGS.  This includes any local_specializations used in the
pattern or condition.  In this testcase our tree walk wasn't finding the use
of i because we weren't walking into the type of a CONSTRUCTOR.  Fixed by
moving the code for doing that from find_parameter_packs_r into
cp_walk_subtrees.

2020-02-11  Jason Merrill  <jason@redhat.com>

PR c++/92583
PR c++/92654
* tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
* pt.c (find_parameter_packs_r): Not here.
gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/cp/tree.c
gcc/testsuite/g++.dg/cpp0x/nondeduced7.C
gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda3.C [new file with mode: 0644]