From e4adc769aa7b952f2719cee0958222bc80e1ce81 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 4 Jan 2024 04:07:34 +0200 Subject: [PATCH] Disable use of std::launder under msvc-14.1. Fixes #160. --- include/boost/core/launder.hpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/include/boost/core/launder.hpp b/include/boost/core/launder.hpp index 850338e..9ec5e7e 100644 --- a/include/boost/core/launder.hpp +++ b/include/boost/core/launder.hpp @@ -11,14 +11,28 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include + #if defined(__has_builtin) # if __has_builtin(__builtin_launder) # define BOOST_CORE_HAS_BUILTIN_LAUNDER # endif #endif -#if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER) -# include +#if defined(BOOST_MSVC) && BOOST_MSVC < 1920 + +// msvc-14.1 suffers from internal compiler errors when using std::launder +// https://github.com/boostorg/core/issues/160 +// https://github.com/boostorg/optional/issues/122 + +#elif (BOOST_CXX_VERSION >= 201703L) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER) + +#include + +#if defined(__cpp_lib_launder) +# define BOOST_CORE_HAS_STD_LAUNDER +#endif + #endif namespace boost @@ -33,7 +47,7 @@ template T* launder( T* p ) return __builtin_launder( p ); } -#elif (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && defined(__cpp_lib_launder) +#elif defined(BOOST_CORE_HAS_STD_LAUNDER) template T* launder( T* p ) {