Constant expression within nested requires clause

Viewed 84

I would expect the following code to produce a compiler error because the nested constraint within the requires clause is not a constant expression. However, Clang 15.0.0 seems to be okay with it and compiles it without any errors. This seems to be a regression compared to Clang version 14.0.0, which does produce the expected error. Is there a good reason for this change in behavior or is this simply a compiler bug of Clang?

struct s
{ static auto b() -> bool; };

template<typename T>
concept c = requires
{ requires T::b(); };

static_assert(not c<s>); // fails with Clang 14, GCC 12.2, and MSVC 19.32
0 Answers
Related