From: Marek Polacek Date: Thu, 1 Nov 2018 18:29:44 +0000 (+0000) Subject: * g++.dg/cpp1z/constexpr-lambda22.C: New test, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3db0b3ba7e3993aed0ce013f6c3a4aca85297a5;p=gcc.git * g++.dg/cpp1z/constexpr-lambda22.C: New test, From-SVN: r265725 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8ac78052a15..e85b37cdb8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-11-01 Marek Polacek + + * g++.dg/cpp1z/constexpr-lambda22.C: New test, + 2018-11-01 Jozef Lawrynowicz * gcc.dg/tree-ssa/cunroll-13.c: Add missing cast from literal to int32. diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda22.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda22.C new file mode 100644 index 00000000000..fcb6ff96d58 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda22.C @@ -0,0 +1,20 @@ +// { dg-do compile } +// { dg-options -std=c++17 } + +#define SA(X) static_assert((X),#X) + +template +constexpr int +foo () +{ + constexpr int a[] = { 1, 2, 3, 4, 5 }; + int i = 0; + auto j = [&] { + for (auto x : a) + i++; + return i; + }(); + return j; +} + +SA (foo() == 5);