diff options
author | Patrick Palka <ppalka@redhat.com> | 2021-11-19 08:54:25 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2021-11-19 08:54:25 -0500 |
commit | fd740165e54151ea794fca34904f5c2e2ea1dcda (patch) | |
tree | c0481c3654f63b5d76040b0ac7fe6214a18d8923 /gcc/tree-loop-distribution.c | |
parent | f316727e5f6a4c58b63bdee9ad6be785f97f5ee7 (diff) | |
download | gcc-fd740165e54151ea794fca34904f5c2e2ea1dcda.zip gcc-fd740165e54151ea794fca34904f5c2e2ea1dcda.tar.gz gcc-fd740165e54151ea794fca34904f5c2e2ea1dcda.tar.bz2 |
c++: nested lambda capturing a capture proxy [PR94376]
Here when determining the type of the FIELD_DECL for the by-value capture
of 'i' in the inner lambda, we incorrectly give it the type const int
instead of int since the effective initializer is the proxy for the outer
capture, and this proxy is const since the outer lambda is non-mutable.
This patch fixes this by making lambda_capture_field_type handle
by-value capturing of capture proxies specially, namely we instead
consider the type of their FIELD_DECL which unlike the proxy has the
true cv-quals of the captured entity.
PR c++/94376
gcc/cp/ChangeLog:
* lambda.c (lambda_capture_field_type): Simplify by handling the
is_this case first. When capturing by-value a capture proxy,
consider the type of the corresponding field instead.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-nested9.C: New test.
Diffstat (limited to 'gcc/tree-loop-distribution.c')
0 files changed, 0 insertions, 0 deletions