aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/C++Frontend/EH/ctor_dtor_count.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/C++Frontend/EH/ctor_dtor_count.cpp b/test/C++Frontend/EH/ctor_dtor_count.cpp
new file mode 100644
index 0000000000..a399c09781
--- /dev/null
+++ b/test/C++Frontend/EH/ctor_dtor_count.cpp
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+static int c;
+
+struct A {
+ A() { ++c; }
+ A(const A&) { ++c; }
+ ~A() { --c; }
+};
+
+struct B {
+ A a;
+ B() { A a; throw 1; }
+};
+
+int main() {
+ try {
+ B b;
+ } catch (...) {}
+ if (!c) printf("All ok!\n");
+ return c;
+}
+