From: Marek Polacek Date: Fri, 18 Jan 2019 16:42:57 +0000 (+0000) Subject: re PR c++/86926 (ICE for a recursive generic lambda) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=89ce81fbe13dc554d489d9f00f92f85164b185d6;p=gcc.git re PR c++/86926 (ICE for a recursive generic lambda) PR c++/86926 * g++.dg/cpp1z/constexpr-lambda23.C: New test. From-SVN: r268080 --- 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); +}