From bfb6384a0ac3ca9383a085bf386367b64088510f Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 4 Feb 2018 12:52:24 +0000 Subject: [PATCH] Assert on incomplete types: begin fixing test failures for msvc-12.0, 14.0, and clang. --- include/boost/type_traits/is_complete.hpp | 4 ++-- include/boost/type_traits/is_convertible.hpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/boost/type_traits/is_complete.hpp b/include/boost/type_traits/is_complete.hpp index 0de36a9..55dbbbf 100644 --- a/include/boost/type_traits/is_complete.hpp +++ b/include/boost/type_traits/is_complete.hpp @@ -27,7 +27,7 @@ namespace boost { -#ifndef BOOST_NO_SFINAE_EXPR +#if !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1900) namespace detail{ @@ -43,7 +43,7 @@ namespace boost { template struct is_complete : public integral_constant::type>::value || (sizeof(detail::check_is_complete(0)) != sizeof(char))> {}; -#elif !defined(BOOST_NO_SFINAE) +#elif !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) namespace detail { diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index 991cdfd..058301f 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -14,11 +14,11 @@ #include #include -#ifndef BOOST_IS_CONVERTIBLE #include #include #include #include +#ifndef BOOST_IS_CONVERTIBLE #include #include #include @@ -487,7 +487,14 @@ struct is_convertible : public integral_constant -struct is_convertible : public integral_constant {}; +struct is_convertible : public integral_constant +{ +#ifdef __clang__ + // clang's intrinsic doesn't assert on incomplete types: + BOOST_STATIC_ASSERT_MSG(boost::is_complete::value || boost::is_void::value || boost::is_array::value, "Destination argument type to is_convertible must be a complete type"); + BOOST_STATIC_ASSERT_MSG(boost::is_complete::value || boost::is_void::value || boost::is_array::value, "From argument type to is_convertible must be a complete type"); +#endif +}; #endif