brintos

brintos / llvm-project-archived public Read only

0
0
Text · 717 B · fc523e3 Raw
40 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3 4// template<unsigned M, unsigned N>5// struct Ackermann {6//   enum {7//     value = M ? (N ? Ackermann<M-1, Ackermann<M, N-1> >::value8//                    : Ackermann<M-1, 1>::value)9//               : N + 110//   };11// };12 13template<unsigned M, unsigned N>14struct Ackermann {15 enum {16   value = Ackermann<M-1, Ackermann<M, N-1>::value >::value17 };18};19 20template<unsigned M> struct Ackermann<M, 0> {21 enum {22   value = Ackermann<M-1, 1>::value23 };24};25 26template<unsigned N> struct Ackermann<0, N> {27 enum {28   value = N + 129 };30};31 32template<> struct Ackermann<0, 0> {33 enum {34   value = 135 };36};37 38int g0[Ackermann<3, 4>::value == 125 ? 1 : -1];39 40