Open chengniansun opened 8 years ago
This crash still occurs on post 16 trunk(ba7cc56782dbf4a26c0a043dd33c7949366e2b0d) https://godbolt.org/z/nerc7aK1x
The code is
// compile with -O1 -std=c++11
template <int> struct C;
template <class> struct A { C<A<A>::x> c; };
A<int> a;
the output is
<source>:2:31: fatal error: recursive template instantiation exceeded maximum depth of 1024
2 | template <class> struct A { C<A<A>::x> c; };
| ^
Program terminated with signal: SIGSEGV
Compiler returned: 139
@llvm/issue-subscribers-clang-frontend
I've also hit this one, with:
template <typename a = int> struct b : b<b<b<b<a>>>> {};
b<> c;
(Which emerged from a creduce
of (what I suspect to be) a different bug)
Testing on Godbolt confirms what @wheatman said: Clang 16.0.0 rejected the code without crashing (and GCC does to). But 17.0.1 and trunk crash.
Regression in 17 confirmed: https://godbolt.org/z/Kc3Eobb6P
Extended Description