Consider the following code:
struct A
{
void foo(this auto &&) noexcept(true) {}
auto bar() -> decltype(foo()) {}
};
Clang 19 rejects this code with the error below, while GCC and MSVC accept it.
<source>:4:28: error: exception specification is not available until end of class definition
4 | auto bar() -> decltype(foo()) {}
| ^
Is this code somehow illegal, or is it a Clang bug? If it's illegal, why? (Why can't the exception specfification be available at this point?)
To be clear, my actual noexcept(...) depends on this, so removing (true) isn't an option.
Also if I start using this in it, GCC starts crashing: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117106
auto bar() { return foo(); }is accepted by Clang as well.