From a1d0b207c523c13b4fa46fd9b77bdb15ce554051 Mon Sep 17 00:00:00 2001 From: Ed Catmur Date: Tue, 6 Sep 2022 19:59:02 +0100 Subject: [PATCH] Replace deprecated intrinsics https://github.com/boostorg/type_traits/issues/173 --- include/boost/type_traits/intrinsics.hpp | 28 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 72b6d90..182cdf4 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -183,25 +183,39 @@ # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty) # define BOOST_IS_EMPTY(T) __is_empty(T) # endif -# if __has_feature(has_trivial_constructor) +# if defined(__has_builtin) && __has_builtin(__is_trivially_constructible) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T) +# elif __has_feature(has_trivial_constructor) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # endif -# if __has_feature(has_trivial_copy) +# if defined(__has_builtin) && __has_builtin(__is_trivially_copyable) +# define BOOST_HAS_TRIVIAL_COPY(T) (__is_trivially_copyable(T) && !is_reference::value) +# elif __has_feature(has_trivial_copy) # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value) # endif -# if __has_feature(has_trivial_assign) +# if defined(__has_builtin) && __has_builtin(__is_trivially_assignable) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__is_trivially_assignable(T&, const T&) && !is_volatile::value && is_assignable::value) +# elif __has_feature(has_trivial_assign) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value && is_assignable::value) # endif -# if __has_feature(has_trivial_destructor) +# if defined(__has_builtin) && __has_builtin(__is_trivially_destructible) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__is_trivially_destructible(T) && is_destructible::value) +# elif __has_feature(has_trivial_destructor) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) && is_destructible::value) # endif -# if __has_feature(has_nothrow_constructor) +# if defined(__has_builtin) && __has_builtin(__is_nothrow_constructible) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__is_nothrow_constructible(T) && is_default_constructible::value) +# elif __has_feature(has_nothrow_constructor) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value) # endif -# if __has_feature(has_nothrow_copy) +# if defined(__has_builtin) && __has_builtin(__is_nothrow_constructible) +# define BOOST_HAS_NOTHROW_COPY(T) (__is_nothrow_constructible(T, const T&) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) +# elif __has_feature(has_nothrow_copy) # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # endif -# if __has_feature(has_nothrow_assign) +# if defined(__has_builtin) && __has_builtin(__is_nothrow_assignable) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__is_nothrow_assignable(T&, const T&) && !is_volatile::value && is_assignable::value) +# elif __has_feature(has_nothrow_assign) # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile::value && is_assignable::value) # endif # if __has_feature(has_virtual_destructor)