aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y/lambda-init19.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-init19.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C
new file mode 100644
index 00000000000..830ecc03a08
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init19.C
@@ -0,0 +1,15 @@
+// PR c++/89767
+// { dg-do compile { target c++14 } }
+
+void bar (int);
+
+void
+foo ()
+{
+ int x = 0;
+ int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;
+ auto z = [x, y = [x] { bar (x); }, x] { y (); bar (x); }; // { dg-error "already captured 'x' in lambda expression" }
+ auto w = [x, a, b, c, d, y = [x] { bar (x); }, e, f, g, h, x] { y (); bar (x + a + b + c + d + e + f + g + h); }; // { dg-error "already captured 'x' in lambda expression" }
+ z ();
+ w ();
+}