From 1f3a3a1553dc316ed002354dce3ba3f081b2e102 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Wed, 13 Jan 2016 10:50:22 +0000 Subject: [PATCH] Fixes for older GCC versions, see issue 11904. --- .../type_traits/is_default_constructible.hpp | 21 ++++++++++++++++++- .../is_nothrow_move_assignable.hpp | 2 +- .../is_nothrow_move_constructible.hpp | 2 +- test/is_default_constr_test.cpp | 2 ++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/include/boost/type_traits/is_default_constructible.hpp b/include/boost/type_traits/is_default_constructible.hpp index 7fd63f8969..0b7d960e7d 100644 --- a/include/boost/type_traits/is_default_constructible.hpp +++ b/include/boost/type_traits/is_default_constructible.hpp @@ -12,6 +12,10 @@ #include #include +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) +#include +#endif + #if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500) #include @@ -28,10 +32,25 @@ namespace boost{ template static boost::type_traits::no_type test(...); }; - +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) + template + struct is_default_constructible_abstract_filter + { + static const bool value = sizeof(is_default_constructible_imp::test(0)) == sizeof(boost::type_traits::yes_type); + }; + template + struct is_default_constructible_abstract_filter + { + static const bool value = false; + }; +#endif } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) + template struct is_default_constructible : public integral_constant::value>::value>{}; +#else template struct is_default_constructible : public integral_constant(0)) == sizeof(boost::type_traits::yes_type)>{}; +#endif template struct is_default_constructible : public is_default_constructible{}; template struct is_default_constructible : public is_default_constructible{}; template struct is_default_constructible : public integral_constant{}; diff --git a/include/boost/type_traits/is_nothrow_move_assignable.hpp b/include/boost/type_traits/is_nothrow_move_assignable.hpp index 9755430ecf..4fb5bd8a6d 100644 --- a/include/boost/type_traits/is_nothrow_move_assignable.hpp +++ b/include/boost/type_traits/is_nothrow_move_assignable.hpp @@ -33,7 +33,7 @@ template struct is_nothrow_move_assignable : public false_type{}; template struct is_nothrow_move_assignable : public false_type{}; #endif -#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) namespace detail{ diff --git a/include/boost/type_traits/is_nothrow_move_constructible.hpp b/include/boost/type_traits/is_nothrow_move_constructible.hpp index 8f4cee2cf9..4c8f734726 100644 --- a/include/boost/type_traits/is_nothrow_move_constructible.hpp +++ b/include/boost/type_traits/is_nothrow_move_constructible.hpp @@ -26,7 +26,7 @@ struct is_nothrow_move_constructible : public integral_constant struct is_nothrow_move_constructible : public ::boost::false_type {}; template struct is_nothrow_move_constructible : public ::boost::false_type{}; -#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) +#elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40800) #include #include diff --git a/test/is_default_constr_test.cpp b/test/is_default_constr_test.cpp index 89444b3789..acc09acf7e 100644 --- a/test/is_default_constr_test.cpp +++ b/test/is_default_constr_test.cpp @@ -198,7 +198,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible:: #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); #endif +#if !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible::value, false); +#endif TT_TEST_END