c++: nested lambda capturing a capture proxy, cont [PR94376]
The r12-5403 fix apparently doesn't handle the case where the inner
lambda explicitly rather than implicitly captures the capture proxy from
the outer lambda, which causes us to reject the first example in the
testcase below.
This is because compared to an implicit capture, the effective initializer
for an explicit capture is wrapped in a location wrapper (pointing to within
the capture list), and this wrapper foils the is_capture_proxy check added
in r12-5403.
The simplest fix appears to be to strip location wrappers accordingly
before checking is_capture_proxy. And to help prevent against this kind
of bug, this patch also makes is_capture_proxy assert it doesn't see a
location wrapper.
PR c++/94376
gcc/cp/ChangeLog:
* lambda.c (lambda_capture_field_type): Strip location wrappers
before checking for a capture proxy.
(is_capture_proxy): Assert that we don't see a location wrapper.
(mark_const_cap_r): Don't call is_constant_capture_proxy on a
location wrapper.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-nested9a.C: New test.