aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2018-11-01 18:29:44 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2018-11-01 18:29:44 +0000
commitd3db0b3ba7e3993aed0ce013f6c3a4aca85297a5 (patch)
tree2ee9792f4d314a140e04c22bc85d69e383975a78 /gcc
parentd8b3b4f4b22e2986a83bce7870d9726fa725ab4d (diff)
downloadgcc-d3db0b3ba7e3993aed0ce013f6c3a4aca85297a5.zip
gcc-d3db0b3ba7e3993aed0ce013f6c3a4aca85297a5.tar.gz
gcc-d3db0b3ba7e3993aed0ce013f6c3a4aca85297a5.tar.bz2
* g++.dg/cpp1z/constexpr-lambda22.C: New test,
From-SVN: r265725
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda22.C20
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8ac7805..e85b37c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-01 Marek Polacek <polacek@redhat.com>
+
+ * g++.dg/cpp1z/constexpr-lambda22.C: New test,
+
2018-11-01 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* 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 0000000..fcb6ff9
--- /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<typename>
+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<int>() == 5);