diff --git a/include/boost/type_traits/has_trivial_copy.hpp b/include/boost/type_traits/has_trivial_copy.hpp index ba4d884..1c567cf 100644 --- a/include/boost/type_traits/has_trivial_copy.hpp +++ b/include/boost/type_traits/has_trivial_copy.hpp @@ -17,6 +17,10 @@ #include #include +#ifdef __clang__ +#include +#endif + // should be the last #include #include @@ -28,7 +32,11 @@ template struct has_trivial_copy_impl { #ifdef BOOST_HAS_TRIVIAL_COPY +# ifdef __clang__ + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible::value); +# else BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T)); +# endif #else BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< @@ -38,6 +46,16 @@ struct has_trivial_copy_impl #endif }; +#ifdef __clang__ + +template +struct has_trivial_copy_impl +{ + static const bool value = has_trivial_copy_impl::value; +}; + +#endif + } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl::value) diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index b5f1e08..8bccb6f 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -181,8 +181,7 @@ # define BOOST_IS_CLASS(T) __is_class(T) # endif # if __has_feature(is_convertible_to) -# include -# define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible_to(T,U) && !::boost::is_abstract::value) +# define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U) # endif # if __has_feature(is_enum) # define BOOST_IS_ENUM(T) __is_enum(T) diff --git a/test/has_trivial_copy_test.cpp b/test/has_trivial_copy_test.cpp index 6ed8df8..9a0a042 100644 --- a/test/has_trivial_copy_test.cpp +++ b/test/has_trivial_copy_test.cpp @@ -12,6 +12,19 @@ # include #endif +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS + +class bug_10389 +{ + int m_data; +public: + bug_10389() { m_data = 0; } + bug_10389(const bug_10389&) = delete; + bug_10389(bug_10389&& r) : m_data(r.m_data) { r.m_data = 0; } +}; + +#endif + TT_TEST_BEGIN(has_trivial_copy) BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, true); @@ -203,6 +216,10 @@ BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); +#endif + TT_TEST_END