aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2017-10-17 08:38:07 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-10-17 08:38:07 +0000
commit54a3b395e0a6adae4fc170c7a69bfedfc4fe9d8d (patch)
tree88978bedbccc5288586a962f5c055376f499d956
parent49dcd8a45afa7564e658b677735538a83ce56cc1 (diff)
downloadgcc-54a3b395e0a6adae4fc170c7a69bfedfc4fe9d8d.zip
gcc-54a3b395e0a6adae4fc170c7a69bfedfc4fe9d8d.tar.gz
gcc-54a3b395e0a6adae4fc170c7a69bfedfc4fe9d8d.tar.bz2
re PR c++/82570 (Lambda fails to compile because it doesn't meet constexpr requirements)
2017-10-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/82570 * g++.dg/cpp1z/constexpr-lambda18.C: New. From-SVN: r253806
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C30
2 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 589ff0e..450e482 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-17 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/82570
+ * g++.dg/cpp1z/constexpr-lambda18.C: New.
+
2017-10-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/82549
diff --git a/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C
new file mode 100644
index 0000000..639018b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/constexpr-lambda18.C
@@ -0,0 +1,30 @@
+// PR c++/82570
+// { dg-options "-std=c++17" }
+
+template< typename Body >
+inline void iterate(Body body)
+{
+ body(10);
+}
+
+template< typename Pred >
+inline void foo(Pred pred)
+{
+ iterate([&](int param)
+ {
+ if (pred(param))
+ {
+ unsigned char buf[4];
+ buf[0] = 0;
+ buf[1] = 1;
+ buf[2] = 2;
+ buf[3] = 3;
+ }
+ });
+}
+
+int main()
+{
+ foo([](int x) { return x > 0; });
+ return 0;
+}