public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/88164] Copy initialization of function argument not performed inside lambda when the argument is a constexpr block scope variable.
[not found] <bug-88164-4@http.gcc.gnu.org/bugzilla/>
@ 2022-02-03 4:57 ` pinskia at gcc dot gnu.org
2022-02-03 5:00 ` pinskia at gcc dot gnu.org
2022-02-03 5:01 ` [Bug c++/88164] Lambda is allowed to capture any constexpr variable without specifying any captures pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-03 4:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88164
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For test, clang rejects it with:
<source>:15:18: error: variable 'a' cannot be implicitly captured in a lambda
with no capture-default specified
return f(a); // Unexpected: does not call the copy constructor,
^
<source>:13:17: note: 'a' declared here
constexpr A a{};
^
<source>:14:19: note: lambda expression begins here
auto lambda = []{
^
<source>:14:20: note: capture 'a' by value
auto lambda = []{
^
a
<source>:14:20: note: capture 'a' by reference
auto lambda = []{
^
&a
<source>:14:20: note: default capture by value
auto lambda = []{
^
=
<source>:14:20: note: default capture by reference
auto lambda = []{
^
&
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/88164] Copy initialization of function argument not performed inside lambda when the argument is a constexpr block scope variable.
[not found] <bug-88164-4@http.gcc.gnu.org/bugzilla/>
2022-02-03 4:57 ` [Bug c++/88164] Copy initialization of function argument not performed inside lambda when the argument is a constexpr block scope variable pinskia at gcc dot gnu.org
@ 2022-02-03 5:00 ` pinskia at gcc dot gnu.org
2022-02-03 5:01 ` [Bug c++/88164] Lambda is allowed to capture any constexpr variable without specifying any captures pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-03 5:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88164
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dragondreamer at live dot com
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95269 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/88164] Lambda is allowed to capture any constexpr variable without specifying any captures
[not found] <bug-88164-4@http.gcc.gnu.org/bugzilla/>
2022-02-03 4:57 ` [Bug c++/88164] Copy initialization of function argument not performed inside lambda when the argument is a constexpr block scope variable pinskia at gcc dot gnu.org
2022-02-03 5:00 ` pinskia at gcc dot gnu.org
@ 2022-02-03 5:01 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-03 5:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88164
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-02-03
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Summary|Copy initialization of |Lambda is allowed to
|function argument not |capture any constexpr
|performed inside lambda |variable without specifying
|when the argument is a |any captures
|constexpr block scope |
|variable. |
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Though I don't know 100% this is invalid code.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-03 5:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-88164-4@http.gcc.gnu.org/bugzilla/>
2022-02-03 4:57 ` [Bug c++/88164] Copy initialization of function argument not performed inside lambda when the argument is a constexpr block scope variable pinskia at gcc dot gnu.org
2022-02-03 5:00 ` pinskia at gcc dot gnu.org
2022-02-03 5:01 ` [Bug c++/88164] Lambda is allowed to capture any constexpr variable without specifying any captures pinskia 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).