public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103760] New: Invalid expression inside lambda inside compound requirement causes an error instead of concept satisfaction failure
@ 2021-12-17 20:57 jacek.olczyk98 at gmail dot com
  2021-12-17 21:13 ` [Bug c++/103760] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jacek.olczyk98 at gmail dot com @ 2021-12-17 20:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103760

            Bug ID: 103760
           Summary: Invalid expression inside lambda inside compound
                    requirement causes an error instead of concept
                    satisfaction failure
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jacek.olczyk98 at gmail dot com
  Target Milestone: ---

When using a lambda expression in a requires clause compound requirement,
placing an expression invalid for some type T inside the lambda causes a
compile error during instantiation, instead of the expected behavior of causing
the concept to not be satisfied.
On clang, the behavior is as expected.

This happens on 10.2, where I discovered it, as well as on trunk. 
Here is the code: https://godbolt.org/z/EnK5G8Yjf

To save a click, the example code is:

template<typename T>
concept Concept = requires (T x) {
    {[](){ return T::foo; }()};
};
static_assert(!Concept<int>);



The expected behavior is to pass the static_assert.
The actual error is:

<source>: In lambda function:
<source>:3:22: error: 'foo' is not a member of 'int'
    3 |     {[](){ return T::foo; }()};
      |                      ^~~

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-13  2:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 20:57 [Bug c++/103760] New: Invalid expression inside lambda inside compound requirement causes an error instead of concept satisfaction failure jacek.olczyk98 at gmail dot com
2021-12-17 21:13 ` [Bug c++/103760] " pinskia at gcc dot gnu.org
2021-12-18 15:44 ` ppalka at gcc dot gnu.org
2021-12-18 22:40 ` pinskia at gcc dot gnu.org
2021-12-19  9:30 ` jacek.olczyk98 at gmail dot com
2021-12-20 14:09 ` ppalka at gcc dot gnu.org
2023-01-03 18:27 ` ppalka at gcc dot gnu.org
2023-06-13  1:49 ` danakj at orodu dot net
2023-06-13  2:12 ` 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).