Bus error when Catch2 tries catching an exception when using Clang 19
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
When Catch2 catches an exception thrown by test code in Clang 19.1 (at least the version I have installed using homebrew on my Mac), it results in a `Bus error: 10`. This occurs regardless of whether or not the exception is raised inside a `REQUIRE` macro, so long as the exception is caught by Catch2. (If I set up a try block to catch the exception myself before any Catch2 code sees it, it doesn't seem to cause a problem.)
**Expected behavior**
Catch2 should catch the exception and produce some kind of reasonable output. If in a `REQUIRE_THROWS` macro where an appropriate exception is raised, the test should pass.
**Reproduction steps**
This test file was enough to trigger the problem for me:
```cpp
#define CATCH_CONFIG_MAIN
#include "catch2/catch_test_macros.hpp"
TEST_CASE( "blah", "blah" ) {
SECTION( "blah" ) {
throw(std::runtime_error("Hi"));
}
}
```
I typically get output like this:
```
Randomness seeded to: 638767569
Bus error: 10
```
**Platform information:**
- OS: **macOS 15**
- Compiler+version: **Clang 19.1** (from homebrew)
- Catch version: **v3.7.1** (compiled from source with same version of Clang)
Contributor guide
Assessment
This issue has not been assessed yet.