aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2017-10-02 12:40:26 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-10-02 12:40:26 +0000
commitbac1187dadc70649c507da4a60ab8215fe534be7 (patch)
tree6d4f7a7065da4abcd194a0a8e653c94a7d01819f /gcc
parent22381c22b4713ccdf504e80d59866b73f7f734fe (diff)
downloadgcc-bac1187dadc70649c507da4a60ab8215fe534be7.zip
gcc-bac1187dadc70649c507da4a60ab8215fe534be7.tar.gz
gcc-bac1187dadc70649c507da4a60ab8215fe534be7.tar.bz2
re PR c++/79180 (Nested lambda-capture causes segfault for parameter pack)
2017-10-02 Paolo Carlini <paolo.carlini@oracle.com> PR c++/79180 * g++.dg/cpp0x/lambda/lambda-nested8.C: New. * g++.dg/torture/pr79180.C: Likewise. PR c++/71386 * g++.dg/cpp1y/lambda-generic-nested1.C: New. From-SVN: r253350
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested8.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-nested1.C34
-rw-r--r--gcc/testsuite/g++.dg/torture/pr79180.C23
4 files changed, 89 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0214693..405a4b0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2017-10-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/79180
+ * g++.dg/cpp0x/lambda/lambda-nested8.C: New.
+ * g++.dg/torture/pr79180.C: Likewise.
+
+ PR c++/71386
+ * g++.dg/cpp1y/lambda-generic-nested1.C: New.
+
2017-10-02 Richard Biener <rguenther@suse.de>
* gcc.dg/graphite/graphite.exp: Add -fdump-tree-graphite-details.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested8.C
new file mode 100644
index 0000000..5a6f47c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested8.C
@@ -0,0 +1,23 @@
+// PR c++/79180
+// { dg-do run { target c++11 } }
+
+void
+foo (int a)
+{
+ if (a != 127)
+ __builtin_abort ();
+}
+
+template <typename... Args>
+void
+bar (Args &&... args)
+{
+ [&]() { [&]() { foo (args...); } (); } ();
+}
+
+int
+main ()
+{
+ int x = 127;
+ bar (x);
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nested1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nested1.C
new file mode 100644
index 0000000..4cfd353
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-nested1.C
@@ -0,0 +1,34 @@
+// PR c++/71386
+// { dg-do run { target c++14 } }
+
+template<class...XS>
+auto List(XS...xs)
+{
+ return [=](auto processList){return processList(xs...);};
+}
+
+auto l1 = List(42);
+
+int test (int a)
+{
+ if (a != 42)
+ __builtin_abort ();
+ return 0;
+}
+
+auto foo = [](auto... xs1)
+ {
+ return [=]()
+ {
+ return l1([=](auto)
+ {
+ return test (xs1...);
+ });
+ };
+ };
+
+int main()
+{
+ auto concat = l1(foo);
+ concat();
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr79180.C b/gcc/testsuite/g++.dg/torture/pr79180.C
new file mode 100644
index 0000000..2e3992c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr79180.C
@@ -0,0 +1,23 @@
+// { dg-do run }
+// { dg-options "-Wall -std=c++11" }
+
+void
+foo (int a)
+{
+ if (a != 127)
+ __builtin_abort ();
+}
+
+template <typename... Args>
+void
+bar (Args &&... args)
+{
+ [&]() { [&]() { foo (args...); } (); } ();
+}
+
+int
+main ()
+{
+ int x = 127;
+ bar (x);
+}