Debian Codegraph @

gcc/testsuite/g++.dg/template/recurse.C

raw
1 // Test for handling of excessive template recursion.
2 // { dg-options "-ftemplate-depth-50 -O" }
3
4 template <int I> struct F
5 {
6 int operator()()
7 {
8 F<I+1> f; // { dg-error "depth" }
9 return f()*I;
10 }
11 };
12
13 template <> struct F<52>
14 {
15 int operator()() { return 0; }
16 };
17
18 int main ()
19 {
20 F<1> f;
21 return f(); // { dg-message "from here" }
22 }
23
24 // { dg-prune-output "compilation terminated" }