diff --git a/checks/test_case.cpp b/checks/test_case.cpp index 844a39c25..3f9279333 100644 --- a/checks/test_case.cpp +++ b/checks/test_case.cpp @@ -621,6 +621,11 @@ # error "Defect macro BOOST_NO_CXX17_STD_INVOKE is defined." # endif #endif +#ifdef TEST_BOOST_NO_CXX17_STD_LAUNDER +# ifdef BOOST_NO_CXX17_STD_LAUNDER +# error "Defect macro BOOST_NO_CXX17_STD_LAUNDER is defined." +# endif +#endif #ifdef TEST_BOOST_NO_CXX17_STRUCTURED_BINDINGS # ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS # error "Defect macro BOOST_NO_CXX17_STRUCTURED_BINDINGS is defined." diff --git a/doc/html/boost_config/boost_macro_reference.html b/doc/html/boost_config/boost_macro_reference.html index 8948684bc..492addb84 100644 --- a/doc/html/boost_config/boost_macro_reference.html +++ b/doc/html/boost_config/boost_macro_reference.html @@ -4184,6 +4184,18 @@

+ + +

+ BOOST_NO_CXX17_STD_LAUNDER +

+ + +

+ The compiler does not support std::launder(). +

+ +

diff --git a/doc/macro_reference.qbk b/doc/macro_reference.qbk index 9a2d1565e..d279f5b22 100644 --- a/doc/macro_reference.qbk +++ b/doc/macro_reference.qbk @@ -1039,6 +1039,7 @@ that are not yet supported by a particular compiler or library. [[`BOOST_NO_CXX17_HDR_VARIANT`][The compiler does not support the header ``.]] [[`BOOST_NO_CXX17_STD_APPLY`][The compiler does not support `std::apply()`.]] [[`BOOST_NO_CXX17_STD_INVOKE`][The compiler does not support `std::invoke()`.]] +[[`BOOST_NO_CXX17_STD_LAUNDER`][The compiler does not support `std::launder()`.]] [[`BOOST_NO_CXX17_ITERATOR_TRAITS`][The compiler does not support SFINAE-friendly `std::iterator_traits`.]] [[`BOOST_NO_CXX17_IF_CONSTEXPR`][The compiler does not support `if constexpr`.]] [[`BOOST_NO_CXX17_INLINE_VARIABLES`][The compiler does not support `inline` variables.]] diff --git a/include/boost/config/assert_cxx17.hpp b/include/boost/config/assert_cxx17.hpp index cd41be61b..9e295cc40 100644 --- a/include/boost/config/assert_cxx17.hpp +++ b/include/boost/config/assert_cxx17.hpp @@ -60,3 +60,6 @@ #ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS # error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STRUCTURED_BINDINGS." #endif +#ifdef BOOST_NO_CXX17_STD_LAUNDER +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STD_LAUNDER." +#endif diff --git a/include/boost/config/detail/cxx_composite.hpp b/include/boost/config/detail/cxx_composite.hpp index a243d41f8..ea6fdbc92 100644 --- a/include/boost/config/detail/cxx_composite.hpp +++ b/include/boost/config/detail/cxx_composite.hpp @@ -178,6 +178,7 @@ || defined(BOOST_NO_CXX17_ITERATOR_TRAITS)\ || defined(BOOST_NO_CXX17_STD_APPLY)\ || defined(BOOST_NO_CXX17_STD_INVOKE)\ + || defined(BOOST_NO_CXX17_STD_LAUNDER)\ || defined(BOOST_NO_CXX17_STRUCTURED_BINDINGS) # define BOOST_NO_CXX17 #endif diff --git a/include/boost/config/stdlib/dinkumware.hpp b/include/boost/config/stdlib/dinkumware.hpp index 46ffe093e..35a1f071f 100644 --- a/include/boost/config/stdlib/dinkumware.hpp +++ b/include/boost/config/stdlib/dinkumware.hpp @@ -193,6 +193,9 @@ #if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 201709) # define BOOST_NO_CXX17_STD_INVOKE #endif +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_VERSION) || (_MSVC_STL_VERSION < 141) +# define BOOST_NO_CXX17_STD_LAUNDER +#endif // C++20 features which aren't configured in suffix.hpp correctly: #if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202008L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0) diff --git a/include/boost/config/stdlib/libcomo.hpp b/include/boost/config/stdlib/libcomo.hpp index 6a8a16196..7fffb20aa 100644 --- a/include/boost/config/stdlib/libcomo.hpp +++ b/include/boost/config/stdlib/libcomo.hpp @@ -80,6 +80,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS // diff --git a/include/boost/config/stdlib/libcpp.hpp b/include/boost/config/stdlib/libcpp.hpp index 0e9f2445e..18d6c8a94 100644 --- a/include/boost/config/stdlib/libcpp.hpp +++ b/include/boost/config/stdlib/libcpp.hpp @@ -94,6 +94,9 @@ # define BOOST_NO_CXX17_HDR_STRING_VIEW # define BOOST_NO_CXX17_HDR_VARIANT #endif +#if (_LIBCPP_VERSION < 6000) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_LAUNDER +#endif #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) # define BOOST_NO_AUTO_PTR #endif diff --git a/include/boost/config/stdlib/libstdcpp3.hpp b/include/boost/config/stdlib/libstdcpp3.hpp index ad70936de..a680f31d6 100644 --- a/include/boost/config/stdlib/libstdcpp3.hpp +++ b/include/boost/config/stdlib/libstdcpp3.hpp @@ -358,9 +358,14 @@ extern "C" char *gets (char *__s); #if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L) # define BOOST_NO_CXX17_STD_INVOKE # define BOOST_NO_CXX17_STD_APPLY +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_STRING_VIEW # define BOOST_NO_CXX17_HDR_VARIANT +#elif !defined(_GLIBCXX_HAVE_BUILTIN_LAUNDER) +//Older Clang compilers have no builtin, so libstdc++ disables +//std::launder on those cases +# define BOOST_NO_CXX17_STD_LAUNDER #endif #if defined(__has_include) diff --git a/include/boost/config/stdlib/modena.hpp b/include/boost/config/stdlib/modena.hpp index 31a26c856..767bf7be5 100644 --- a/include/boost/config/stdlib/modena.hpp +++ b/include/boost/config/stdlib/modena.hpp @@ -69,6 +69,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Modena C++ standard library" diff --git a/include/boost/config/stdlib/msl.hpp b/include/boost/config/stdlib/msl.hpp index f2f825983..a26835daf 100644 --- a/include/boost/config/stdlib/msl.hpp +++ b/include/boost/config/stdlib/msl.hpp @@ -93,6 +93,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/include/boost/config/stdlib/roguewave.hpp b/include/boost/config/stdlib/roguewave.hpp index 03a65768c..a8fe03444 100644 --- a/include/boost/config/stdlib/roguewave.hpp +++ b/include/boost/config/stdlib/roguewave.hpp @@ -205,4 +205,5 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS diff --git a/include/boost/config/stdlib/sgi.hpp b/include/boost/config/stdlib/sgi.hpp index c49957cef..177d74f5f 100644 --- a/include/boost/config/stdlib/sgi.hpp +++ b/include/boost/config/stdlib/sgi.hpp @@ -163,6 +163,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "SGI standard library" diff --git a/include/boost/config/stdlib/stlport.hpp b/include/boost/config/stdlib/stlport.hpp index 38bc763f9..e884a8c5d 100644 --- a/include/boost/config/stdlib/stlport.hpp +++ b/include/boost/config/stdlib/stlport.hpp @@ -253,6 +253,7 @@ namespace boost { using std::min; using std::max; } // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/include/boost/config/stdlib/vacpp.hpp b/include/boost/config/stdlib/vacpp.hpp index b14dd6557..b7034abfc 100644 --- a/include/boost/config/stdlib/vacpp.hpp +++ b/include/boost/config/stdlib/vacpp.hpp @@ -69,6 +69,7 @@ // C++17 features # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_STD_INVOKE +# define BOOST_NO_CXX17_STD_LAUNDER # define BOOST_NO_CXX17_ITERATOR_TRAITS #define BOOST_STDLIB "Visual Age default standard library" diff --git a/include/boost/config/stdlib/xlcpp_zos.hpp b/include/boost/config/stdlib/xlcpp_zos.hpp index a5e02fd8b..c044d6c4c 100644 --- a/include/boost/config/stdlib/xlcpp_zos.hpp +++ b/include/boost/config/stdlib/xlcpp_zos.hpp @@ -58,4 +58,5 @@ #define BOOST_NO_CXX17_STD_INVOKE #define BOOST_NO_CXX17_STD_APPLY +#define BOOST_NO_CXX17_STD_LAUNDER #define BOOST_NO_CXX17_ITERATOR_TRAITS diff --git a/test/all/Jamfile.v2 b/test/all/Jamfile.v2 index afa805036..bca3c4fa5 100644 --- a/test/all/Jamfile.v2 +++ b/test/all/Jamfile.v2 @@ -391,6 +391,9 @@ test-suite "BOOST_NO_CXX17_STD_APPLY" : test-suite "BOOST_NO_CXX17_STD_INVOKE" : [ run ../no_cxx17_std_invoke_pass.cpp ] [ compile-fail ../no_cxx17_std_invoke_fail.cpp ] ; +test-suite "BOOST_NO_CXX17_STD_LAUNDER" : +[ run ../no_cxx17_std_launder_pass.cpp ] +[ compile-fail ../no_cxx17_std_launder_fail.cpp ] ; test-suite "BOOST_NO_CXX17_STRUCTURED_BINDINGS" : [ run ../no_cxx17_structured_bindings_pass.cpp ] [ compile-fail ../no_cxx17_structured_bindings_fail.cpp ] ; diff --git a/test/boost_no_cxx17_std_launder.ipp b/test/boost_no_cxx17_std_launder.ipp new file mode 100644 index 000000000..9a618f464 --- /dev/null +++ b/test/boost_no_cxx17_std_launder.ipp @@ -0,0 +1,28 @@ +// (C) Copyright Ion Gaztanaga. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for most recent version. + +// MACRO: BOOST_NO_CXX17_STD_LAUNDER +// TITLE: launder +// DESCRIPTION: The compiler supports the std::launder() function. + +#include + +namespace boost_no_cxx17_std_launder { + +struct X +{ + const int const_int; +}; + +int test() +{ + X original{1}; + new (&original) X{2}; //Overwrite X + return std::launder(&original)->const_int == 2 ? 0 : -1; //After laundering, new value should be returned +} + +} diff --git a/test/config_info.cpp b/test/config_info.cpp index aa322fd10..624c47f8c 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -1183,6 +1183,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_CXX17_ITERATOR_TRAITS); PRINT_MACRO(BOOST_NO_CXX17_STD_APPLY); PRINT_MACRO(BOOST_NO_CXX17_STD_INVOKE); + PRINT_MACRO(BOOST_NO_CXX17_STD_LAUNDER); PRINT_MACRO(BOOST_NO_CXX17_STRUCTURED_BINDINGS); PRINT_MACRO(BOOST_NO_CXX20_HDR_BARRIER); PRINT_MACRO(BOOST_NO_CXX20_HDR_BIT); diff --git a/test/config_test.cpp b/test/config_test.cpp index 7d11598cb..6fa203593 100644 --- a/test/config_test.cpp +++ b/test/config_test.cpp @@ -452,6 +452,11 @@ namespace boost_no_cxx17_std_apply = empty_boost; #else namespace boost_no_cxx17_std_invoke = empty_boost; #endif +#ifndef BOOST_NO_CXX17_STD_LAUNDER +#include "boost_no_cxx17_std_launder.ipp" +#else +namespace boost_no_cxx17_std_launder = empty_boost; +#endif #ifndef BOOST_NO_CXX17_STRUCTURED_BINDINGS #include "boost_no_cxx17_structured_bindings.ipp" #else diff --git a/test/config_test.cu b/test/config_test.cu index c7e4e8a60..a14158d3a 100644 --- a/test/config_test.cu +++ b/test/config_test.cu @@ -367,6 +367,11 @@ namespace boost_no_cxx17_std_apply = empty_boost; #else namespace boost_no_cxx17_std_invoke = empty_boost; #endif +#ifndef BOOST_NO_CXX17_STD_LAUNDER +#include "boost_no_cxx17_std_launder.ipp" +#else +namespace boost_no_cxx17_std_launder = empty_boost; +#endif #ifndef BOOST_NO_CXX17_STRUCTURED_BINDINGS #include "boost_no_cxx17_structured_bindings.ipp" #else diff --git a/test/no_cxx14_std_exchange_fail.cpp b/test/no_cxx14_std_exchange_fail.cpp index c71003774..71135cf12 100644 --- a/test/no_cxx14_std_exchange_fail.cpp +++ b/test/no_cxx14_std_exchange_fail.cpp @@ -10,9 +10,9 @@ // -// Test file for macro BOOST_NO_CXX17_STD_APPLY +// Test file for macro BOOST_NO_CXX14_STD_EXCHANGE // This file should not compile, if it does then -// BOOST_NO_CXX17_STD_APPLY should not be defined. +// BOOST_NO_CXX14_STD_EXCHANGE should not be defined. // See file boost_no_cxx17_std_apply.ipp for details // Must not have BOOST_ASSERT_CONFIG set; it defeats diff --git a/test/no_cxx14_std_exchange_pass.cpp b/test/no_cxx14_std_exchange_pass.cpp index edac2fbf5..d577072fc 100644 --- a/test/no_cxx14_std_exchange_pass.cpp +++ b/test/no_cxx14_std_exchange_pass.cpp @@ -10,10 +10,10 @@ // -// Test file for macro BOOST_NO_CXX17_STD_APPLY +// Test file for macro BOOST_NO_CXX14_STD_EXCHANGE // This file should compile, if it does not then // BOOST_NO_CXX!/_STD_APPLY should be defined. -// See file boost_no_cxx17_std_apply.ipp for details +// See file boost_no_cxx14_std_exchange.ipp for details // Must not have BOOST_ASSERT_CONFIG set; it defeats // the objective of this file: diff --git a/test/no_cxx17_std_launder_fail.cpp b/test/no_cxx17_std_launder_fail.cpp new file mode 100644 index 000000000..8af0e280d --- /dev/null +++ b/test/no_cxx17_std_launder_fail.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Fri Oct 14 12:13:46 2016 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX17_STD_LAUNDER +// This file should not compile, if it does then +// BOOST_NO_CXX17_STD_LAUNDER should not be defined. +// See file boost_no_cxx17_std_launder.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifdef BOOST_NO_CXX17_STD_LAUNDER +#include "boost_no_cxx17_std_launder.ipp" +#else +#error "this file should not compile" +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx17_std_launder::test(); +} + diff --git a/test/no_cxx17_std_launder_pass.cpp b/test/no_cxx17_std_launder_pass.cpp new file mode 100644 index 000000000..b44e800c6 --- /dev/null +++ b/test/no_cxx17_std_launder_pass.cpp @@ -0,0 +1,37 @@ +// This file was automatically generated on Fri Oct 14 12:13:46 2016 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + + +// Test file for macro BOOST_NO_CXX17_STD_LAUNDER +// This file should compile, if it does not then +// BOOST_NO_CXX17_STD_LAUNDER should be defined. +// See file boost_no_cxx17_std_launder.ipp for details + +// Must not have BOOST_ASSERT_CONFIG set; it defeats +// the objective of this file: +#ifdef BOOST_ASSERT_CONFIG +# undef BOOST_ASSERT_CONFIG +#endif + +#include +#include "test.hpp" + +#ifndef BOOST_NO_CXX17_STD_LAUNDER +#include "boost_no_cxx17_std_launder.ipp" +#else +namespace boost_no_cxx17_std_launder = empty_boost; +#endif + +int main( int, char *[] ) +{ + return boost_no_cxx17_std_launder::test(); +} +