public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression
@ 2021-06-13  1:46 jbassett271 at gmail dot com
  2021-06-14  8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: jbassett271 at gmail dot com @ 2021-06-13  1:46 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101043
           Summary: ICE in check_noexcept_r for lambda conditional
                    noexcept via requires expression
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbassett271 at gmail dot com
  Target Milestone: ---

GCC has an internal compiler error for requires expressions inside the noexcept
clause of a lambda inside a templated function:

https://godbolt.org/z/oWhq9sf8M


template <typename T>
struct set {
  bool contains(T const&) const { return true; }
};

template <typename T>
void intersect(set<T> const& lhs, set<T> const& rhs) {
  auto f = [&]<typename T1>(T1&& _1) noexcept(requires {
    { rhs.contains(_1) } noexcept;
  }) {
      return rhs.contains(_1);
  };
}

int main() {
  set<int> lhs;
  set<int> rhs;
  intersect(lhs, rhs);
}


Error message:

<source>: In instantiation of 'void intersect(const set<T>&, const set<T>&)
[with T = int]':
<source>:18:21:   required from here
<source>:9:7: internal compiler error: in check_noexcept_r, at cp/except.c:1123
    9 |     { rhs.contains(_1) } noexcept;
      |     ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.


The commandline arguments, according to the Compiler Explorer link (cleaned a
little):

-g -o output.s -masm=intel -S -fdiagnostics-color=always -std=c++20 example.cpp

Clang compiles this fine.

I was able to replicate this bug in GCC versions 10.1, 10.2, 10.3, and 11.1.

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

end of thread, other threads:[~2023-11-15 17:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13  1:46 [Bug c++/101043] New: ICE in check_noexcept_r for lambda conditional noexcept via requires expression jbassett271 at gmail dot com
2021-06-14  8:57 ` [Bug c++/101043] " marxin at gcc dot gnu.org
2021-10-01 10:22 ` pinskia at gcc dot gnu.org
2021-10-01 10:25 ` pinskia at gcc dot gnu.org
2023-11-15 17:18 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:20 ` 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).