Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bus error when Catch2 tries catching an exception when using Clang 19 #2913

Open
quantheory opened this issue Sep 26, 2024 · 1 comment
Open

Comments

@quantheory
Copy link

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:

#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)
@quantheory
Copy link
Author

I should note that I'm not positive whether this is really a Catch2 error, or an issue with the particular Clang installation I have. It would be nice to know if anyone else can reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant