Add tests and tentative fix for issue with clang mis-identifying pairs of non-constructible types. See github #51.

This commit is contained in:
John Maddock
2018-01-25 13:18:38 +00:00
parent 5ed289c317
commit a6e879f091
3 changed files with 9 additions and 0 deletions

View File

@ -16,6 +16,9 @@
#if BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
#include <boost/type_traits/is_abstract.hpp>
#endif
#ifdef __clang__
#include <utility> // std::pair
#endif
#if !defined(BOOST_NO_CXX11_DECLTYPE) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500)
@ -55,6 +58,9 @@ namespace boost{
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>{};
#ifdef __clang__
template <class T, class U> struct is_default_constructible<std::pair<T,U> > : public integral_constant<bool, is_default_constructible<T>::value && is_default_constructible<U>::value>{};
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template <class T> struct is_default_constructible<T&&> : public integral_constant<bool, false>{};
#endif

View File

@ -207,6 +207,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<bug11324_derived>::v
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<private_construct>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor<deleted_construct>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::has_trivial_constructor<std::pair<deleted_construct, int> >::value), false);
#endif
TT_TEST_END

View File

@ -197,9 +197,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<test_abc1>::value,
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<bug11324_derived>::value, false);
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<deleted_default_construct>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_default_constructible<std::pair<deleted_default_construct, int> >::value), false);
#endif
#if !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40800)
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_default_constructible<private_default_construct>::value, false);
BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_default_constructible<std::pair<private_default_construct, int> >::value), false);
#endif
TT_TEST_END