The following minimal reproducible example contains a template struct B with default argument type containing a lambda A<[]{ return 1; }>, B is recursively inherited from B<>. And there is a specialization of B for any A<z>.
template<auto>
struct A{};
template<class = A<[]{ return 1; }>>
struct B : B<> {};
template<auto z>
struct B<A<z>> {};
B<int> x;
GCC is ok with the example, by Clang complains:
error: implicit instantiation of template 'B<A<{}>>' within its own definition
Demo: https://gcc.godbolt.org/z/xzjzo7dE9
Which compiler is right here?
P.S. If one modifies the definition of B this way:
template<class>
struct B : B<A<[]{ return 1; }>> {};
then all compilers become totally happy, demo: https://gcc.godbolt.org/z/roqnc39eq