OSDN Git Service

2010-02-21 Paolo Carlini <paolo.carlini@oracle.com>
[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-error "exceeds maximum" "exceeds" { target *-*-* } 8 }
10       return f()*I;             // { dg-message "instantiated" "recurse" }
11     }
12 };
13
14 template <> struct F<52>
15 {
16   int operator()() { return 0; }
17 };
18
19 int main ()
20 {
21   F<1> f;
22   return f();           // { dg-message "instantiated from here" "excessive recursion" }
23 }
24
25 // Ignore excess messages from recursion.
26 // { dg-prune-output "instantiated from 'int" }