From 81f0dbdc23235db3f056e7170c7cc1da1b3103f8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 28 Aug 2003 20:33:46 +0000 Subject: [PATCH] Add another testcase I found lying around. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8186 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/C++Frontend/EH/ctor_dtor_count.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/C++Frontend/EH/ctor_dtor_count.cpp 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 00000000000..a399c097818 --- /dev/null +++ b/test/C++Frontend/EH/ctor_dtor_count.cpp @@ -0,0 +1,23 @@ +#include + +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; +} +