From 143f5a307908690f93d86b5f5f885444a2446158 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 21 Feb 2018 09:59:52 -0500 Subject: Handle C++17 std::uncaught_exceptions (GH #590) --- algparam.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'algparam.h') diff --git a/algparam.h b/algparam.h index 09c4b8cd..4870f59e 100644 --- a/algparam.h +++ b/algparam.h @@ -3,7 +3,6 @@ /// \file algparam.h /// \brief Classes for working with NameValuePairs - #ifndef CRYPTOPP_ALGPARAM_H #define CRYPTOPP_ALGPARAM_H @@ -309,8 +308,11 @@ public: virtual ~AlgorithmParametersBase() CRYPTOPP_THROW { -#ifdef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE - if (!std::uncaught_exception()) + +#if defined(CRYPTOPP_CXX17_EXCEPTIONS) + if (std::uncaught_exceptions() == 0) +#elif defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE) + if (std::uncaught_exception() == false) #else try #endif @@ -318,7 +320,7 @@ public: if (m_throwIfNotUsed && !m_used) throw ParameterNotUsed(m_name); } -#ifndef CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE +#if !defined(CRYPTOPP_CXX17_EXCEPTIONS) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE) catch(const Exception&) { } -- cgit v1.2.1