From 1f76fbd168a9db5ffee39e33b751da81704bbc8d Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Tue, 31 Jul 2018 17:30:43 -0700 Subject: [PATCH] Dev/annagrin/failfast in noexcept mode windows (#710) made terminate call __fastfail in noexcept mode when using msvc --- include/gsl/gsl_assert | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert index 131fa8b..be4676b 100644 --- a/include/gsl/gsl_assert +++ b/include/gsl/gsl_assert @@ -26,6 +26,8 @@ // #if defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS #define GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND +#include +#define RANGE_CHECKS_FAILURE 0 #endif // @@ -82,10 +84,15 @@ namespace details #if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) typedef void (__cdecl *terminate_handler)(); + + [[noreturn]] inline void __cdecl default_terminate_handler() + { + __fastfail(RANGE_CHECKS_FAILURE); + } inline gsl::details::terminate_handler& get_terminate_handler() noexcept { - static terminate_handler handler = &abort; + static terminate_handler handler = &default_terminate_handler; return handler; }