public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference
[not found] <bug-83167-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-07 19:34 ` pinskia at gcc dot gnu.org
2022-10-27 5:23 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-07 19:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83167
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=79620,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94376
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
No compiler fully accepts this code.
clang fails on the 2nd and 4th asserts
ICC fails on the 2nd assert only
MSVC fails on all 4 asserts.
GCC fails on the first 2 asserts.
GCC is the only one that fails on the 1st assert via not being captured.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference
[not found] <bug-83167-4@http.gcc.gnu.org/bugzilla/>
2021-08-07 19:34 ` [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference pinskia at gcc dot gnu.org
@ 2022-10-27 5:23 ` pinskia at gcc dot gnu.org
2023-12-08 21:57 ` cvs-commit at gcc dot gnu.org
2023-12-08 21:58 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-27 5:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83167
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I might have seen a dup of this bug before.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference
[not found] <bug-83167-4@http.gcc.gnu.org/bugzilla/>
2021-08-07 19:34 ` [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference pinskia at gcc dot gnu.org
2022-10-27 5:23 ` pinskia at gcc dot gnu.org
@ 2023-12-08 21:57 ` cvs-commit at gcc dot gnu.org
2023-12-08 21:58 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-08 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83167
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:d9965fef40794d548021d2e34844e5fafeca4ce5
commit r14-6350-gd9965fef40794d548021d2e34844e5fafeca4ce5
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Dec 8 16:57:13 2023 -0500
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference
[not found] <bug-83167-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2023-12-08 21:57 ` cvs-commit at gcc dot gnu.org
@ 2023-12-08 21:58 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-12-08 21:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83167
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.0
CC| |ppalka at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Narrowly fixed for GCC 14, thanks for the bug report.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-08 21:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-83167-4@http.gcc.gnu.org/bugzilla/>
2021-08-07 19:34 ` [Bug c++/83167] decltype((x)) inside lambda is considered odr-use if x is not a reference pinskia at gcc dot gnu.org
2022-10-27 5:23 ` pinskia at gcc dot gnu.org
2023-12-08 21:57 ` cvs-commit at gcc dot gnu.org
2023-12-08 21:58 ` ppalka at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).