Closed
Description
Compiler Explorer: https://godbolt.org/z/66397fTff
struct Foo {
static void f(auto) requires(false) {}
void f(int) {}
static void g() {
static constexpr auto b = [](auto v) {
return requires { f(v); };
} (0);
static_assert(b == false);
}
};
Clang versions <= 18 and other compilers accept this program. The requires expression should be false, since f(0)
is ill-formed in the context inside the lambda.