[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / ackermann.cpp
blobfc523e392eafefe17780b5ff3b312d1df995b914
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
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 // };
13 template<unsigned M, unsigned N>
14 struct Ackermann {
15 enum {
16 value = Ackermann<M-1, Ackermann<M, N-1>::value >::value
20 template<unsigned M> struct Ackermann<M, 0> {
21 enum {
22 value = Ackermann<M-1, 1>::value
26 template<unsigned N> struct Ackermann<0, N> {
27 enum {
28 value = N + 1
32 template<> struct Ackermann<0, 0> {
33 enum {
34 value = 1
38 int g0[Ackermann<3, 4>::value == 125 ? 1 : -1];