Please consider a C++20 concept program:
struct A {};
template<typename T>
concept DerivedOnceFromA = requires(T t) { { static_cast<const A&>(t) }; };
template<DerivedOnceFromA T>
struct B {};
struct C : A
{
B<C> foo();
};
Here the concept DerivedOnceFromA checks that T can be statically cast to A. B is template struct following this concept. And struct C is derived from A (so the concept is satisfied) and defines a function that returns B<C>.
This code is accepted by GCC and MSVC, but rejected by Clang with the error:
constraints not satisfied for class template 'B' [with T = C]
Demo: https://gcc.godbolt.org/z/7Tc7xdbeq
Is it legal to use class as concepted template parameter inside class body (so what compiler is right)?