summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C
new file mode 100644
index 0000000000..482193e975
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C
@@ -0,0 +1,18 @@
+// DR 1612
+// { dg-require-effective-target c++11 }
+
+int main() {
+ static int result;
+ struct A { int x; };
+ struct B { int y; };
+ union {
+ A a; B b;
+ };
+ a.x = 1;
+ [=]() mutable {
+ a.x = 2; // { dg-error "anonymous union" }
+ result = b.y; // { dg-error "anonymous union" }
+ }();
+ if (result == 1) return 0;
+ throw 0;
+}