gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C
raw| 1 | // DR 1612 |
| 2 | // { dg-require-effective-target c++11 } |
| 3 | |
| 4 | int main() { |
| 5 | static int result; |
| 6 | struct A { int x; }; |
| 7 | struct B { int y; }; |
| 8 | union { |
| 9 | A a; B b; |
| 10 | }; |
| 11 | a.x = 1; |
| 12 | [=]() mutable { |
| 13 | a.x = 2; // { dg-error "anonymous union" } |
| 14 | result = b.y; // { dg-error "anonymous union" } |
| 15 | }(); |
| 16 | if (result == 1) return 0; |
| 17 | throw 0; |
| 18 | } |