From 70e0d48978655010447b6e6ddef5aa6c781d844b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 28 Sep 2017 12:47:32 +0200 Subject: [PATCH] Replace throw; with std::rethrow_exception(std::current_exception()); This works around a bug in libcxxrt handling of active exception count that caused std::uncaught_exception() to return true even if there was none. Closes #1028 --- include/internal/catch_exception_translator_registry.cpp | 4 ++-- include/internal/catch_interfaces_exception.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_exception_translator_registry.cpp b/include/internal/catch_exception_translator_registry.cpp index ce45194b..77f74a88 100644 --- a/include/internal/catch_exception_translator_registry.cpp +++ b/include/internal/catch_exception_translator_registry.cpp @@ -37,7 +37,7 @@ namespace Catch { #endif } catch( TestFailureException& ) { - throw; + std::rethrow_exception(std::current_exception()); } catch( std::exception& ex ) { return ex.what(); @@ -55,7 +55,7 @@ namespace Catch { std::string ExceptionTranslatorRegistry::tryTranslators() const { if( m_translators.empty() ) - throw; + std::rethrow_exception(std::current_exception()); else return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() ); } diff --git a/include/internal/catch_interfaces_exception.h b/include/internal/catch_interfaces_exception.h index 40b7e59b..3473ff52 100644 --- a/include/internal/catch_interfaces_exception.h +++ b/include/internal/catch_interfaces_exception.h @@ -15,6 +15,7 @@ static std::string translatorName( signature ) #endif +#include #include #include @@ -47,7 +48,7 @@ namespace Catch { std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { try { if( it == itEnd ) - throw; + std::rethrow_exception(std::current_exception()); else return (*it)->translate( it+1, itEnd ); }