Skip to content

Commit

Permalink
Fixes for older GCC versions, see issue 11904.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzmaddock committed Jan 13, 2016
1 parent 0bbffe0 commit 1f3a3a1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion include/boost/type_traits/is_default_constructible.hpp
Expand Up @@ -12,6 +12,10 @@
#include <boost/type_traits/integral_constant.hpp>
#include <boost/detail/workaround.hpp>

#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
#include <boost/type_traits/is_abstract.hpp>
#endif

#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500)

#include <boost/type_traits/detail/yes_no_type.hpp>
Expand All @@ -28,10 +32,25 @@ namespace boost{
template<typename>
static boost::type_traits::no_type test(...);
};

#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
template<class T, bool b>
struct is_default_constructible_abstract_filter
{
static const bool value = sizeof(is_default_constructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type);
};
template<class T>
struct is_default_constructible_abstract_filter<T, true>
{
static const bool value = false;
};
#endif
}

#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
template <class T> struct is_default_constructible : public integral_constant<bool, detail::is_default_constructible_abstract_filter<T, boost::is_abstract<T>::value>::value>{};
#else
template <class T> struct is_default_constructible : public integral_constant<bool, sizeof(detail::is_default_constructible_imp::test<T>(0)) == sizeof(boost::type_traits::yes_type)>{};
#endif
template <class T, std::size_t N> struct is_default_constructible<T[N]> : public is_default_constructible<T>{};
template <class T> struct is_default_constructible<T[]> : public is_default_constructible<T>{};
template <class T> struct is_default_constructible<T&> : public integral_constant<bool, false>{};
Expand Down
2 changes: 1 addition & 1 deletion include/boost/type_traits/is_nothrow_move_assignable.hpp
Expand Up @@ -33,7 +33,7 @@ template <class T> struct is_nothrow_move_assignable<T&> : public false_type{};
template <class T> struct is_nothrow_move_assignable<T&&> : 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{

Expand Down
Expand Up @@ -26,7 +26,7 @@ struct is_nothrow_move_constructible : public integral_constant<bool, BOOST_IS_N
template <class T> struct is_nothrow_move_constructible<volatile T> : public ::boost::false_type {};
template <class T> struct is_nothrow_move_constructible<const volatile T> : 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 <boost/type_traits/declval.hpp>
#include <boost/utility/enable_if.hpp>
Expand Down
2 changes: 2 additions & 0 deletions test/is_default_constr_test.cpp
Expand Up @@ -198,7 +198,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<bug11324_derived>::
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<deleted_default_construct>::value, false);
#endif
#if !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<private_default_construct>::value, false);
#endif

TT_TEST_END

0 comments on commit 1f3a3a1

Please sign in to comment.