c++: Fix sizeof VLA lambda capture.
authorJason Merrill <jason@redhat.com>
Fri, 31 Jan 2020 22:10:30 +0000 (17:10 -0500)
committerJason Merrill <jason@redhat.com>
Sat, 1 Feb 2020 00:06:37 +0000 (19:06 -0500)
commit00a49cd840f60774b0e9e0109fb10559bc9a9194
treed8daf51a689a88ba7901d32f63fedfe8fc9ab22f
parente98ebda074bf8fc5f630a93085af81f52437d851
c++: Fix sizeof VLA lambda capture.

sizeof a VLA type is not a constant in C or the GNU C++ extension, so we
need to capture the VLA even in unevaluated context.  For PR60855 we stopped
looking through a previous capture, but we also need to capture the first
time the variable is mentioned.

PR c++/86216
* semantics.c (process_outer_var_ref): Capture VLAs even in
unevaluated context.
gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-vla5.C [new file with mode: 0644]