Skip to content

Commit

Permalink
Disable use of std::launder under msvc-14.1. Fixes #160.
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Jan 4, 2024
1 parent 8af04d1 commit e4adc76
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions include/boost/core/launder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,28 @@
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <boost/config.hpp>

#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 <new>
#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 <new>

#if defined(__cpp_lib_launder)
# define BOOST_CORE_HAS_STD_LAUNDER
#endif

#endif

namespace boost
Expand All @@ -33,7 +47,7 @@ template<class T> 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<class T> T* launder( T* p )
{
Expand Down

0 comments on commit e4adc76

Please sign in to comment.