aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-anon1.C
blob: 482193e975d60151541c41bfe82a649b0dbb5434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
}