Suppose I'm writing a class template some of whose members are constrained on the presence and value of a type template parameter static constexpr data member:
template<class T>
struct A {
constexpr bool operator()() requires T::value { return T::value; }
constexpr bool operator()() { return false; }
};
#include <type_traits>
static_assert(A<std::true_type>()());
static_assert(!A<std::false_type>()());
static_assert(!A<void>()());
MSVC and gcc accept this, but clang rejects unless I replace requires T::value
with requires requires { requires T::value; }
. Is this a bug in clang, or are the other compilers lax; is it the case that C++ requires requires requires requires? What does the Standard say?
Related (well, ⅔ at least): Why do we require requires requires?