1 // Test that we properly clean up if we get an exception in the middle of 2 // constructing the closure object. 3 // { dg-options -std=c++0x } 4 5 // This test fails because of PR 41449; it isn't a lambda issue. 6 // { dg-do run { xfail *-*-* } } 7 8 struct A 9 { AA10 A() {} AA11 A(const A&) { throw 1; } 12 }; 13 14 int bs; 15 struct B 16 { BB17 B() { ++bs; } BB18 B(const B&) { ++bs; } ~BB19 ~B() { --bs; } 20 }; 21 main()22int main() 23 { 24 { 25 B b1, b2; 26 A a; 27 28 try 29 { 30 [b1, a, b2]{ }; 31 } 32 catch(...) {} 33 } 34 return bs; 35 } 36