[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / fibonacci.cpp
blobff1711fc529f2a9015c4816d875548fa8525d39c
1 // RUN: %clang_cc1 -fsyntax-only %s
3 template<unsigned I>
4 struct FibonacciEval;
6 template<unsigned I>
7 struct Fibonacci {
8 enum { value = FibonacciEval<I-1>::value + FibonacciEval<I-2>::value };
9 };
11 template<unsigned I>
12 struct FibonacciEval {
13 enum { value = Fibonacci<I>::value };
16 template<> struct Fibonacci<0> {
17 enum { value = 0 };
20 template<> struct Fibonacci<1> {
21 enum { value = 1 };
24 int array5[Fibonacci<5>::value == 5? 1 : -1];
25 int array10[Fibonacci<10>::value == 55? 1 : -1];
27 template<unsigned I>
28 struct FibonacciEval2;
30 template<unsigned I>
31 struct Fibonacci2 {
32 static const unsigned value
33 = FibonacciEval2<I-1>::value + FibonacciEval2<I-2>::value;
36 template<unsigned I>
37 struct FibonacciEval2 {
38 static const unsigned value = Fibonacci2<I>::value;
41 template<> struct Fibonacci2<0> {
42 static const unsigned value = 0;
45 template<> struct Fibonacci2<1> {
46 static const unsigned value = 1;
49 int array5_2[Fibonacci2<5>::value == 5? 1 : -1];
50 int array10_2[Fibonacci2<10>::value == 55? 1 : -1];
52 template<unsigned I>
53 struct Fibonacci3 {
54 static const unsigned value = Fibonacci3<I-1>::value + Fibonacci3<I-2>::value;
57 template<> struct Fibonacci3<0> {
58 static const unsigned value = 0;
61 template<> struct Fibonacci3<1> {
62 static const unsigned value = 1;
65 int array5_3[Fibonacci3<5>::value == 5? 1 : -1];
66 int array10_3[Fibonacci3<10>::value == 55? 1 : -1];