Skip to content

Commit

Permalink
tests: Test that we can throw and catch the same exception multiple t…
Browse files Browse the repository at this point in the history
…imes sequentially.

This originally came up as an issue with libc++abi support (#152), but is not specific to that ABI.
  • Loading branch information
ngrewe authored and triplef committed Dec 15, 2020
1 parent bd274a7 commit b0787e1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ addtest_variants("CXXExceptions" "CXXException.m;CXXException.cc" true)
addtest_variants("ForwardDeclareProtocolAccess" "ForwardDeclareProtocolAccess.m;ForwardDeclareProtocol.m" true)
if (ENABLE_OBJCXX)
addtest_variants(ObjCXXEHInterop "ObjCXXEHInterop.mm;ObjCXXEHInterop.m" true)
addtest_variants(ObjCXXEHInteropTwice "ObjCXXEHInteropTwice.mm" true)
# This test is failing on Win32, but not for any obvious reason. Disable
# it for now to keep CI happy.
if (WIN32)
Expand Down
22 changes: 22 additions & 0 deletions Test/ObjCXXEHInteropTwice.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#import "Test.h"

#import "stdio.h"


void excerciseExceptionCXX(Test *e) {
@try {
printf("Raising Test\n");
@throw e;
} @catch (Test *localException) {
printf("Caught\n");
}
}

int main(void)
{
Test *e = [Test new];
excerciseExceptionCXX(e);
excerciseExceptionCXX(e);
[e release];
}

0 comments on commit b0787e1

Please sign in to comment.