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; +} +