Redirect std::uncaught_exception to Catch::uncaught_exception

This means that only one place needs to work with warnings from
the deprecation of `std::uncaught_exception()` in C++17.

Closes #1162.
This commit is contained in:
Josh Lospinoso 2018-01-26 10:59:47 -05:00 committed by Martin Hořeňovský
parent 5e484862f2
commit 5201e92564
6 changed files with 61 additions and 18 deletions

View file

@ -8,6 +8,7 @@
#include "catch_message.h"
#include "catch_interfaces_capture.h"
#include "catch_uncaught_exceptions.h"
namespace Catch {
@ -49,18 +50,9 @@ namespace Catch {
getResultCapture().pushScopedMessage( m_info );
}
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996) // std::uncaught_exception is deprecated in C++17
#endif
ScopedMessage::~ScopedMessage() {
if ( !std::uncaught_exception() ){
if ( !uncaught_exceptions() ){
getResultCapture().popScopedMessage(m_info);
}
}
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
} // end namespace Catch