1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3// template<unsigned M, unsigned N>
4// struct Ackermann {
5//   enum {
6//     value = M ? (N ? Ackermann<M-1, Ackermann<M, N-1> >::value
7//                    : Ackermann<M-1, 1>::value)
8//               : N + 1
9//   };
10// };
11
12template<unsigned M, unsigned N>
13struct Ackermann {
14 enum {
15   value = Ackermann<M-1, Ackermann<M, N-1>::value >::value
16 };
17};
18
19template<unsigned M> struct Ackermann<M, 0> {
20 enum {
21   value = Ackermann<M-1, 1>::value
22 };
23};
24
25template<unsigned N> struct Ackermann<0, N> {
26 enum {
27   value = N + 1
28 };
29};
30
31template<> struct Ackermann<0, 0> {
32 enum {
33   value = 1
34 };
35};
36
37int g0[Ackermann<3, 4>::value == 125 ? 1 : -1];
38
39