aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/recurse.C
blob: 94b56f67e99376a3f14ee57ebda22b0fc03b4176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Test for handling of excessive template recursion.
// { dg-options "-ftemplate-depth-50 -O" }

template <int I> struct F
{
  int operator()()
    {
      F<I+1> f;			// { dg-error "incomplete type" "incomplete" }
				// { dg-bogus "exceeds maximum.*exceeds maximum" "exceeds" { xfail *-*-* } 8 }
                                // { dg-error "exceeds maximum" "exceeds" { xfail *-*-* } 8 }
      return f()*I;             // { dg-message "recursively" "recurse" }
    }
};

template <> struct F<52>
{
  int operator()() { return 0; }
};

int main ()
{
  F<1> f;
  return f();		// { dg-message "from here" "excessive recursion" }
}

// Ignore excess messages from recursion.
// { dg-prune-output "from 'int" }