From 89ce81fbe13dc554d489d9f00f92f85164b185d6 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 18 Jan 2019 16:42:57 +0000 Subject: [PATCH] re PR c++/86926 (ICE for a recursive generic lambda) PR c++/86926 * g++.dg/cpp1z/constexpr-lambda23.C: New test. From-SVN: r268080 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 19f5b21aee9..28b74d507de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-18 Marek Polacek + + PR c++/86926 + * g++.dg/cpp1z/constexpr-lambda23.C: New test. + 2019-01-18 H.J. Lu PR middle-end/88587 diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda23.C new file mode 100644 index 00000000000..4ff866b5d94 --- /dev/null +++ b/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); +} -- 2.30.2