Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C

raw
1 // PR c++/86926
2 // { dg-do compile { target c++17 } }
3
4 int
5 main()
6 {
7 constexpr auto f = [](auto self, auto n) {
8 if(n < 2)
9 return n;
10 return self(self, n - 1) + self(self, n - 2);
11 };
12
13 constexpr auto fibonacci = [=](auto n) { return f(f, n); };
14
15 static_assert(fibonacci(7) == 13);
16 }