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

infinite loop with latest libstd++ #352

Closed
kirkshoop opened this issue Nov 12, 2014 · 5 comments
Closed

infinite loop with latest libstd++ #352

kirkshoop opened this issue Nov 12, 2014 · 5 comments

Comments

@kirkshoop
Copy link

This bug causes std::uncaught_exception() to always return true once a std::exception_ptr has been passed to std::rethrow_exception()
Bug 62258 - uncaught_exception() equals to `true' after rethrow_exception()

The issue is that this line in Catch causes an early return from the destructor even when no exception is in flight.

While pathological, it would be nice if Catch defended against infinite loops. std::terminate() would be fine with me.

@kirkshoop
Copy link
Author

FYI This hack works.

#include <exception>
namespace std {
inline bool uncaught_exception() noexcept(true) {return current_exception() != nullptr;}
}

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

@philsquared
Copy link
Collaborator

Sorry for the delay - just catching up with this.
Firstly: thanks for reporting this - especially with all the background info - that makes things much easier to reason about (even if a bit frustrating in this case).
I tried your proposed workaround (more specifically I tried just checking for a current_exception() instead of uncaught_exception() ) and it doesn't work for me (clang/xcode 6.1.1).

Infinite loop detection is probably a good idea - although it doesn't really solve the problem. I'll see what I can do.

@ecorm
Copy link

ecorm commented Dec 21, 2014

I was testing code that makes use of std::exception_ptr and ran into a situation where the test case would be repeated infinitely for mysterious reasons. kirkshoop's hack fixed the problem (and restored my sanity). I'm using gcc 4.8.2 on Linux Mint.

@joto
Copy link

joto commented Apr 13, 2015

Is this the same as #271?

@philsquared
Copy link
Collaborator

For anyone still watching this issue - I've committed some changes (on Develop) that may address it. Please let me know either way if you try it.

@horenmar horenmar added the Resolved - pending review Issue waiting for feedback from the original author label Jan 13, 2017
@horenmar horenmar closed this as completed Feb 6, 2017
@horenmar horenmar removed the Resolved - pending review Issue waiting for feedback from the original author label Feb 6, 2017
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

5 participants