diff options
author | Jonathan Roelofs <jonathan@codesourcery.com> | 2015-01-21 19:05:37 +0000 |
---|---|---|
committer | Jonathan Roelofs <jonathan@codesourcery.com> | 2015-01-21 19:05:37 +0000 |
commit | c0b48088747387dd36c652afc37f854d5bba3c24 (patch) | |
tree | 5c0783510e3ca981653e737a027259cc8c806097 /test/unwind_01.pass.cpp | |
parent | d2a72c45bb125271df1e68aa66bdf6bc77a2ce96 (diff) |
Rename all of the tests in preparation for merging lit configs with libcxx
http://reviews.llvm.org/D7101
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@226691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/unwind_01.pass.cpp')
-rw-r--r-- | test/unwind_01.pass.cpp | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/test/unwind_01.pass.cpp b/test/unwind_01.pass.cpp new file mode 100644 index 0000000..9d237f8 --- /dev/null +++ b/test/unwind_01.pass.cpp @@ -0,0 +1,96 @@ +//===------------------------- unwind_01.cpp ------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include <assert.h> + +struct A +{ + static int count; + int id_; + A() : id_(++count) {} + ~A() {assert(id_ == count--);} + +private: + A(const A&); + A& operator=(const A&); +}; + +int A::count = 0; + +struct B +{ + static int count; + int id_; + B() : id_(++count) {} + ~B() {assert(id_ == count--);} + +private: + B(const B&); + B& operator=(const B&); +}; + +int B::count = 0; + +struct C +{ + static int count; + int id_; + C() : id_(++count) {} + ~C() {assert(id_ == count--);} + +private: + C(const C&); + C& operator=(const C&); +}; + +int C::count = 0; + +void f2() +{ + C c; + A a; + throw 55; + B b; +} + +void f1() +{ + A a; + B b; + f2(); + C c; +} + +int main() +{ + try + { + f1(); + assert(false); + } + catch (int* i) + { + assert(false); + } + catch (long i) + { + assert(false); + } + catch (int i) + { + assert(i == 55); + } + catch (...) + { + assert(false); + } + assert(A::count == 0); + assert(B::count == 0); + assert(C::count == 0); +} |