diff options
author | Patrick Palka <ppalka@redhat.com> | 2023-12-08 16:57:13 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2023-12-08 16:57:13 -0500 |
commit | d9965fef40794d548021d2e34844e5fafeca4ce5 (patch) | |
tree | d1846780678b641da3ab33f077b3c0c4bac3ef9c /libgcc | |
parent | 0bef72539e585d13941987369cf34726a7ac5b2e (diff) | |
download | gcc-d9965fef40794d548021d2e34844e5fafeca4ce5.zip gcc-d9965fef40794d548021d2e34844e5fafeca4ce5.tar.gz gcc-d9965fef40794d548021d2e34844e5fafeca4ce5.tar.bz2 |
c++: decltype of (non-captured variable) [PR83167]
For decltype((x)) within a lambda where x is not captured, we dubiously
require that the lambda has a capture default, unlike for decltype(x).
But according to [expr.prim.id.unqual]/3 we should just ignore the lambda
in this case. This patch narrowly fixes this issue by disabling the
capture_decltype handling and falling back to the ordinary handling when
the innermost lambda has no capture-default. In fact, we can restrict
the special handling to only by-copy lambdas since that's what
[expr.prim.id.unqual]/3 is concerned with; for by-ref implicit captures
both code paths should give the same result anyway.
During review some other issues were discovered which are documented in
a new FIXME.
PR c++/83167
gcc/cp/ChangeLog:
* semantics.cc (capture_decltype): Inline into its only caller ...
(finish_decltype_type): ... here. Update nearby comment to refer
to recent standard. Add FIXME. Restrict uncaptured variable type
transformation to happen only for lambdas with a by-copy
capture-default.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-decltype4.C: New test.
Diffstat (limited to 'libgcc')
0 files changed, 0 insertions, 0 deletions