[Bug c++/126406] New: __is_nothrow_invocable crashes gcc

"cassio.neri at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126406

            Bug ID: 126406
           Summary: __is_nothrow_invocable crashes gcc
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cassio.neri at gmail dot com
  Target Milestone: ---

This code crashes GCC 16:

```
#include <functional>

void f();

static_assert(std::invoke<decltype(f)>);
```

The crash report says:

```
internal compiler error: in type_throw_all_p, at cp/except.cc:1278
```

See https://godbolt.org/z/8a8aejYqh

The bare minimum to reproduce that I came up with is this:

```
template<typename F>
void invoke(F&&) noexcept(__is_nothrow_invocable(F)) {
}

void f();

static_assert(invoke<decltype(f)>);
```

See https://godbolt.org/z/nc9Es5z67

GCC 15 has no issue.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.