diff --git a/include/turtle/config.hpp b/include/turtle/config.hpp index 8e42051..9395005 100644 --- a/include/turtle/config.hpp +++ b/include/turtle/config.hpp @@ -25,8 +25,9 @@ # endif #endif -#if defined(__cpp_lib_uncaught_exceptions) || defined(_MSC_VER) && (_MSC_VER >= 1900) -# ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS +#ifndef MOCK_NO_UNCAUGHT_EXCEPTIONS +# if(defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411) || \ + (defined(_MSC_VER) && _MSC_VER >= 1900) # define MOCK_UNCAUGHT_EXCEPTIONS # endif #endif diff --git a/include/turtle/detail/function_impl.hpp b/include/turtle/detail/function_impl.hpp index e3524a2..c11f386 100644 --- a/include/turtle/detail/function_impl.hpp +++ b/include/turtle/detail/function_impl.hpp @@ -1,6 +1,7 @@ // http://turtle.sourceforge.net // -// Copyright Mathieu Champlon 2012 +// Copyright 2012 Mathieu Champlon +// Copyright 2025 Alexander Grund // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -80,7 +81,7 @@ namespace mock { namespace detail { typedef safe_error> error_type; public: - function_impl() : context_(0), valid_(true), exceptions_(exceptions()), mutex_(std::make_shared()) {} + function_impl() : exceptions_(exceptions()), mutex_(std::make_shared()) {} virtual ~function_impl() { if(valid_ && exceptions_ >= exceptions()) @@ -314,8 +315,8 @@ namespace mock { namespace detail { }; std::list expectations_; - context* context_; - mutable bool valid_; + context* context_ = nullptr; + mutable bool valid_ = true; const int exceptions_; const std::shared_ptr mutex_; };