The following code makes clang to crash. See at godbolt.
template<int N>
struct A {
template<class C>
friend auto cica(const A<N-1>&, C) {
return N-1;
}
};
template<>
struct A<0> {
template<class C>
friend auto cica(const A<0>&, C);
};
template <int N, class AT, class = decltype(cica(AT{}, nullptr))>
static constexpr bool MakeCica(int);
template <int N, class AT>
static constexpr bool MakeCica(short, A<N+1> = {});
template <int N, class AT = A<N>, class Val = decltype(MakeCica<N, AT>(0))>
static constexpr bool has_cica = Val{};
constexpr bool cica2 = has_cica<0> || has_cica<0>;