aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-28 20:33:46 +0000
committerChris Lattner <sabre@nondot.org>2003-08-28 20:33:46 +0000
commit81f0dbdc23235db3f056e7170c7cc1da1b3103f8 (patch)
tree2fcf9813563e4ec0f0b7096afe20c69f0f9c277a
parent206c7d029dd3444aa2fb3f4526e2fc729e6f5465 (diff)
Add another testcase I found lying around.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8186 91177308-0d34-0410-b5e6-96231b3b80d8
-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;
+}
+