This test got fixed by r267859, so let's add it. Unfortunately, it still ICEs on the gcc-8 branch.
Tested on x86_64-linux, applying to trunk. 2019-01-18 Marek Polacek <pola...@redhat.com> PR c++/86926 * g++.dg/cpp1z/constexpr-lambda23.C: New test. diff --git gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C new file mode 100644 index 00000000000..4ff866b5d94 --- /dev/null +++ gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C @@ -0,0 +1,16 @@ +// PR c++/86926 +// { dg-do compile { target c++17 } } + +int +main() +{ + constexpr auto f = [](auto self, auto n) { + if(n < 2) + return n; + return self(self, n - 1) + self(self, n - 2); + }; + + constexpr auto fibonacci = [=](auto n) { return f(f, n); }; + + static_assert(fibonacci(7) == 13); +}