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

Leaf sections sometimes skipped with Clang+libc++ on Linux #807

Closed
u3shit opened this issue Feb 5, 2017 · 2 comments
Closed

Leaf sections sometimes skipped with Clang+libc++ on Linux #807

u3shit opened this issue Feb 5, 2017 · 2 comments

Comments

@u3shit
Copy link

u3shit commented Feb 5, 2017

Description

When compiling with clang+libc++, and an exception was thrown before (even in a different test-case), Catch will sometime execute a test case where all child sections are skipped. The CHECK in the example below should succeed in all cases, yet it fails with clang and libc++ (with expansion 0 > 0). Compiling with clang and gcc's libstdc++, with gcc, or with clang-cl it works fine, so either libc++ implements something differently and catch doesn't like it, or it's simply buggy (previously I've found a bug in libcxxrt's exception handling code while debugging a luajit related issue, so it's possible...).

Steps to reproduce

Here's a minimal example that triggers the problem.

#define CATCH_CONFIG_MAIN
#include <catch.hpp>

TEST_CASE("a")
{
    CHECK_THROWS(throw 3);
}

TEST_CASE("b")
{
    int i = 0;
    SECTION("a") { i = 1; }
    SECTION("b") { i = 2; }
    CHECK(i > 0);
}

Compile it with clang++ -stdlib=libc++. Optimization levels or -std=c++11, -std=c++14 don't matter. If I only run test case b, it works correctly.

Extra information

  • Catch version: v1.7.0
  • Operating System: Gentoo
  • Compiler+version: clang 3.9.1, libcxxrt from git master
@u3shit
Copy link
Author

u3shit commented Feb 6, 2017

Okay, I'm pretty sure libcxxrt is at fault here: https://github.com/pathscale/libcxxrt/issues/45
Basically std::uncaught_exception() returns true after a rethrow, even when there's no active exceptions.
Closing the issue here.

@u3shit u3shit closed this as completed Feb 6, 2017
@horenmar
Copy link
Member

horenmar commented Feb 6, 2017

We have had similar thing going on with libstdc++ in the past (#352, #271 and possibly others), this is the first time with libc++.

Thank you for the followup and raising issue against libcxxrt.

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

2 participants