OSDN Git Service

448c34721c21d2a7d6478228f50c94ba4da99f8c
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / recurse.C
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 "incomplete type" "incomplete" }
9                                 // { dg-bogus "exceeds maximum.*exceeds maximum" "exceeds" { xfail *-*-* } 8 }
10                                 // { dg-error "exceeds maximum" "exceeds" { xfail *-*-* } 8 }
11       return f()*I;             // { dg-message "recursively instantiated" "recurse" }
12     }
13 };
14
15 template <> struct F<52>
16 {
17   int operator()() { return 0; }
18 };
19
20 int main ()
21 {
22   F<1> f;
23   return f();           // { dg-message "instantiated from here" "excessive recursion" }
24 }
25
26 // Ignore excess messages from recursion.
27 // { dg-prune-output "instantiated from 'int" }