https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103096
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Maybe the compiler could notice that there is only one qHash function template,
and so realize that the instantiation recursion of qHash<X> instantiating
qHash<Y> instantiating qHash<Z> etc. will never terminate.
That check would be defeated by any indirection though:
template <typename T> int qHash2(const T& a);
template <typename T> int qHash(const T& a)
{
return qHash2(pair<T, T>(a, a));
}
template <typename T> int qHash2(const T& a) { return qHash(a); }
The general case is the halting problem, which is why we just have the
-ftemplate-depth=n limit to stop it at some arbitrary point.