blob: 48fbbbb3cf1db617a5631984d2aaf8c7ba873a01 [file] [log] [blame]
Douglas Gregor199d9912009-06-05 00:53:49 +00001// RUN: clang-cc -fsyntax-only -ftemplate-depth=1000 -verify %s
2
3// template<unsigned M, unsigned N>
4// struct Ackermann {
5// enum {
6// value = M ? (N ? Ackermann<M-1, Ackermann<M-1, 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, 8>::value == 2045 ? 1 : -1];