diff options
author | Simon Martin <simon@nasilyan.com> | 2025-03-12 20:15:39 +0100 |
---|---|---|
committer | Simon Martin <simon@nasilyan.com> | 2025-03-12 20:16:01 +0100 |
commit | 90e53ecdbfcc482ad3d0090658427de6d44a5d49 (patch) | |
tree | a76977ab64b67bd1efdee42b0be5abe965fb891a /libstdc++-v3/testsuite/std | |
parent | 9ee6c2619b256878d43800a16f7b98b3ddf59e52 (diff) | |
download | gcc-90e53ecdbfcc482ad3d0090658427de6d44a5d49.zip gcc-90e53ecdbfcc482ad3d0090658427de6d44a5d49.tar.gz gcc-90e53ecdbfcc482ad3d0090658427de6d44a5d49.tar.bz2 |
c++: Look through capture proxy from outer lambda instead of erroring out [PR110584]
We've been rejecting this valid code since r8-4571:
=== cut here ===
void foo (float);
int main () {
constexpr float x = 0;
(void) [&] () {
foo (x);
(void) [] () {
foo (x);
};
};
}
=== cut here ===
The problem is that when processing X in the inner lambda,
process_outer_var_ref errors out even though it does find the constant
capture from the enclosing lambda.
This patch makes sure that process_outer_var_ref properly looks through
normal capture proxies, if any.
PR c++/110584
gcc/cp/ChangeLog:
* cp-tree.h (strip_normal_capture_proxy): Declare.
* lambda.cc (strip_normal_capture_proxy): New function to look
through normal capture proxies.
(build_capture_proxy): Use it.
* semantics.cc (process_outer_var_ref): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-nested10.C: New test.
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions