Skip to content

Commit 81dbc53

Browse files
authored
Merge pull request #71678 from al45tair/eng/PR-122995672
2 parents 7a4fcc6 + 88aa111 commit 81dbc53

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/public/runtime/Exception.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <unwind.h>
2828

29+
#include "swift/Runtime/Debug.h"
2930
#include "swift/Runtime/Exception.h"
3031

3132
using namespace swift;
@@ -39,11 +40,17 @@ _swift_exceptionPersonality(int version,
3940
struct _Unwind_Exception *exceptionObject,
4041
struct _Unwind_Context *context)
4142
{
43+
#if __cpp_exceptions
4244
// Handle exceptions by catching them and calling std::terminate().
4345
// This, in turn, will trigger the unhandled exception routine in the
4446
// C++ runtime.
4547
__cxa_begin_catch(exceptionObject);
4648
std::terminate();
49+
#else
50+
fatalError(0,
51+
"C++ exception handling detected but the Swift runtime was "
52+
"compiled with exceptions disabled\n");
53+
#endif
4754

4855
return _URC_FATAL_PHASE1_ERROR;
4956
}

0 commit comments

Comments
 (0)