blob: f386a6a28f16682a0263a26a950167384a37817a [file] [log] [blame]
Richard Smithab91ef12012-07-08 02:38:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify -ftemplate-depth 512 -ftemplate-backtrace-limit 4 %s
2
NAKAMURA Takumifff457f2012-07-08 09:35:16 +00003// XFAIL: mingw32
4
Richard Smithab91ef12012-07-08 02:38:24 +00005template<int N> struct S {
6 typedef typename S<N-1>::type type;
7 static int f(int n = S<N-1>::f()); // \
8// expected-error{{recursive template instantiation exceeded maximum depth of 512}} \
9// expected-note 3 {{instantiation of default function argument}} \
10// expected-note {{skipping 509 contexts in backtrace}} \
11// expected-note {{use -ftemplate-depth=N to increase recursive template instantiation depth}}
12
13};
14template<> struct S<0> {
15 typedef int type;
16};
17
18// Incrementally instantiate up to S<2048>.
19template struct S<256>;
20template struct S<512>;
21template struct S<768>;
22template struct S<1024>;
23template struct S<1280>;
24template struct S<1536>;
25template struct S<1792>;
26template struct S<2048>;
27
28// Check that we actually bail out when we hit the instantiation depth limit for
29// the default arguments.
30void g() { S<2048>::f(); } // expected-note {{required here}}