https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103096
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libstdc++ |c++
Last reconfirmed| |2021-11-05
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> same for clang++, so possibly a libstdc++ issue.
No, the library isn't to blame here at all:
template<typename T, typename U>
struct pair
{
pair(const T& t, const U& u) : first(t), second(u) { }
T first;
U second;
};
template <typename T> int qHash(const T& a)
{
return qHash(pair<T, T>(a, a));
}
void f(int);
int main()
{
int a = 3;
f(qHash(a));
}
The compiler should indeed hit the template instantiation limit, but it takes
too long to do that. If you use -ftemplate-depth=10 it fails immediately.
The default value is 900 and the exponential growth here slows us down long
before we get there. Even -ftemplate-depth=100 takes forever.