https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> --- The problem with this testcase is that in evaluating arma::is_Mat_fixed_only<arma::eOp<arma::Col<double>, arma::eop_exp> >::value we need to look up check<arma::eOp<arma::Col<double>, arma::eop_exp>>, which means looking up arma::eOp<arma::Col<double>, arma::eop_exp>::Mat_fixed_type, which means instantiating arma::eOp<arma::Col<double>, arma::eop_exp> if it isn't already complete. Which means instantiating arma::Base<double, arma::eOp<arma::Col<double>, arma::eop_exp>> Which means substituting into arma::Base_eval<elem_type, derived, arma::is_Mat<derived>::value> Which depends on arma::is_Mat_fixed_only<arma::eOp<arma::Col<double>, arma::eop_exp> >::value, which is where we started. So instantiating the decl ends up requiring its own definition, though the actual value does not depend on itself, so we could probably allow it. The loop would be avoided if arma::eOp<arma::Col<double>, arma::eop_exp> is instantiated before we try to instantiate the value. Here's a simpler testcase that doesn't happen to fail with GCC for some reason, but does with clang: template <class T> struct B; template <bool b> struct C { }; template <class T> struct A: C<B<A<T>>::value> { typedef T Type; }; template<class T> struct B { template<typename X> static int check(typename X::Type*); template<typename> static char check(...); static const bool value = (sizeof(check<T>(0)) == sizeof(int)); }; int main() { return B<A<int>>::value; }