aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C
new file mode 100644
index 0000000..7516fe0
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh.C
@@ -0,0 +1,35 @@
+// Test that we properly clean up if we get an exception in the middle of
+// constructing the closure object.
+
+// This test fails because of PR 41449; it isn't a lambda issue.
+// { dg-do run { xfail *-*-* } }
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+ A() {}
+ A(const A&) { throw 1; }
+};
+
+int bs;
+struct B
+{
+ B() { ++bs; }
+ B(const B&) { ++bs; }
+ ~B() { --bs; }
+};
+
+int main()
+{
+ {
+ B b1, b2;
+ A a;
+
+ try
+ {
+ [b1, a, b2]{ };
+ }
+ catch(...) {}
+ }
+ return bs;
+}