public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103212] New: requires expression with lambda fails
@ 2021-11-12 13:37 egor.pugin at gmail dot com
2021-11-12 13:40 ` [Bug c++/103212] " egor.pugin at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: egor.pugin at gmail dot com @ 2021-11-12 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103212
Bug ID: 103212
Summary: requires expression with lambda fails
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: egor.pugin at gmail dot com
Target Milestone: ---
---
constexpr bool test = requires { [](auto o){}(0); };
static_assert(test);
---
gives
<source>:1:37: error: expected primary-expression before 'auto'
1 | constexpr bool test = requires { [](auto o){}(0); };
| ^~~~
Also see for compiler comparison:
https://godbolt.org/z/zYGa733d4
msvc fails that condition, clang compiles ok.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/103212] requires expression with lambda fails
2021-11-12 13:37 [Bug c++/103212] New: requires expression with lambda fails egor.pugin at gmail dot com
@ 2021-11-12 13:40 ` egor.pugin at gmail dot com
2021-11-12 23:27 ` [Bug c++/103212] requires expression with lambda inside causes a parse error pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: egor.pugin at gmail dot com @ 2021-11-12 13:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103212
--- Comment #1 from Egor Pugin <egor.pugin at gmail dot com> ---
Original code was closer to something like this:
---
#include <memory>
constexpr bool test = requires { [](auto o) {}(std::unique_ptr<int>{}); };
static_assert(test);
---
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/103212] requires expression with lambda inside causes a parse error
2021-11-12 13:37 [Bug c++/103212] New: requires expression with lambda fails egor.pugin at gmail dot com
2021-11-12 13:40 ` [Bug c++/103212] " egor.pugin at gmail dot com
@ 2021-11-12 23:27 ` pinskia at gcc dot gnu.org
2022-10-31 8:04 ` pinskia at gcc dot gnu.org
2023-05-25 13:10 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-12 23:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103212
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-11-12
Summary|requires expression with |requires expression with
|lambda fails |lambda inside causes a
| |parse error
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplified testcase:
static_assert(requires { [](int){}(0); });
Note even though MSVC parses this code correctly, it still says the
static_assert is valid which is obviously wrong :).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/103212] requires expression with lambda inside causes a parse error
2021-11-12 13:37 [Bug c++/103212] New: requires expression with lambda fails egor.pugin at gmail dot com
2021-11-12 13:40 ` [Bug c++/103212] " egor.pugin at gmail dot com
2021-11-12 23:27 ` [Bug c++/103212] requires expression with lambda inside causes a parse error pinskia at gcc dot gnu.org
@ 2022-10-31 8:04 ` pinskia at gcc dot gnu.org
2023-05-25 13:10 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-31 8:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103212
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |12.1.0
Known to work| |12.2.0
Keywords| |needs-bisection
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like this has been fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/103212] requires expression with lambda inside causes a parse error
2021-11-12 13:37 [Bug c++/103212] New: requires expression with lambda fails egor.pugin at gmail dot com
` (2 preceding siblings ...)
2022-10-31 8:04 ` pinskia at gcc dot gnu.org
@ 2023-05-25 13:10 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-25 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103212
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Keywords|needs-bisection |
Resolution|--- |DUPLICATE
CC| |ppalka at gcc dot gnu.org
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fully fixed for GCC 12.2+ by the fixes for PR101677 / PR105541 it seems. This
is close enough to a dup of the latter.
*** This bug has been marked as a duplicate of bug 105541 ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-25 13:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 13:37 [Bug c++/103212] New: requires expression with lambda fails egor.pugin at gmail dot com
2021-11-12 13:40 ` [Bug c++/103212] " egor.pugin at gmail dot com
2021-11-12 23:27 ` [Bug c++/103212] requires expression with lambda inside causes a parse error pinskia at gcc dot gnu.org
2022-10-31 8:04 ` pinskia at gcc dot gnu.org
2023-05-25 13:10 ` 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).