From e6a523d6eb2ee53a399da43b55f5b4e1bd7810ec Mon Sep 17 00:00:00 2001 From: anonymous Date: Mon, 4 Oct 2010 11:35:39 +0700 Subject: __cxa_get_exception_ptr implementation --- test/test_exception.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test_exception.cc b/test/test_exception.cc index 8149fbf..eb738ba 100644 --- a/test/test_exception.cc +++ b/test/test_exception.cc @@ -29,6 +29,16 @@ struct bar : foo }; +/** + * Non-pod type to test throwing + */ +class non_pod { +public: + non_pod(int i): x(i) {} + int x; +}; + + static int cleanup_count; /** * Simple structure declared with a destructor. Destroying this object will @@ -59,11 +69,12 @@ int inner(int i) case 2: fprintf(stderr, "Throwing int64_t\n");throw (int64_t)1; case 3: { foo f = {2} ; throw f; } case 4: { bar f; f.i = 2 ; f.bar=1 ; throw f; } + case 5: throw non_pod(3); } return -1; } -int outer(int i) throw(float, int, foo) +int outer(int i) throw(float, int, foo, non_pod) { //CLEANUP inner(i); @@ -97,6 +108,11 @@ static void test_catch(int s) TEST((s == 3 || s == 4) && f.i == 2, "Caught struct"); return; } + catch (non_pod np) { + fprintf(stderr, "Caught non_pod {%d}!\n", np.x); + TEST(s == 5 && np.x == 3, "Caught non_pod"); + return; + } //abort(); TEST(0, "Unreachable line reached"); } @@ -153,6 +169,7 @@ void test_exceptions(void) TEST_CLEANUP(test_catch(1)); TEST_CLEANUP(test_catch(3)); TEST_CLEANUP(test_catch(4)); + TEST_CLEANUP(test_catch(5)); TEST_CLEANUP(test_nested()); try{ test_catch(2); -- cgit v1.2.3