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