1// RUN: %clang_cc1 -fsyntax-only %s
2
3template<unsigned I>
4struct FibonacciEval;
5
6template<unsigned I>
7struct Fibonacci {
8  enum { value = FibonacciEval<I-1>::value + FibonacciEval<I-2>::value };
9};
10
11template<unsigned I>
12struct FibonacciEval {
13  enum { value = Fibonacci<I>::value };
14};
15
16template<> struct Fibonacci<0> {
17  enum { value = 0 };
18};
19
20template<> struct Fibonacci<1> {
21  enum { value = 1 };
22};
23
24int array5[Fibonacci<5>::value == 5? 1 : -1];
25int array10[Fibonacci<10>::value == 55? 1 : -1];
26
27template<unsigned I>
28struct FibonacciEval2;
29
30template<unsigned I>
31struct Fibonacci2 {
32  static const unsigned value
33    = FibonacciEval2<I-1>::value + FibonacciEval2<I-2>::value;
34};
35
36template<unsigned I>
37struct FibonacciEval2 {
38  static const unsigned value = Fibonacci2<I>::value;
39};
40
41template<> struct Fibonacci2<0> {
42  static const unsigned value = 0;
43};
44
45template<> struct Fibonacci2<1> {
46  static const unsigned value = 1;
47};
48
49int array5_2[Fibonacci2<5>::value == 5? 1 : -1];
50int array10_2[Fibonacci2<10>::value == 55? 1 : -1];
51
52template<unsigned I>
53struct Fibonacci3 {
54  static const unsigned value = Fibonacci3<I-1>::value + Fibonacci3<I-2>::value;
55};
56
57template<> struct Fibonacci3<0> {
58  static const unsigned value = 0;
59};
60
61template<> struct Fibonacci3<1> {
62  static const unsigned value = 1;
63};
64
65int array5_3[Fibonacci3<5>::value == 5? 1 : -1];
66int array10_3[Fibonacci3<10>::value == 55? 1 : -1];
67