summaryrefslogtreecommitdiff
path: root/boost/type_traits/is_convertible.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/type_traits/is_convertible.hpp')
-rw-r--r--boost/type_traits/is_convertible.hpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/boost/type_traits/is_convertible.hpp b/boost/type_traits/is_convertible.hpp
index 417ece20b4..bf648fc46e 100644
--- a/boost/type_traits/is_convertible.hpp
+++ b/boost/type_traits/is_convertible.hpp
@@ -14,6 +14,10 @@
#include <boost/type_traits/intrinsics.hpp>
#include <boost/type_traits/integral_constant.hpp>
+#include <boost/type_traits/is_complete.hpp>
+#include <boost/type_traits/is_void.hpp>
+#include <boost/type_traits/is_array.hpp>
+#include <boost/static_assert.hpp>
#ifndef BOOST_IS_CONVERTIBLE
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/type_traits/detail/config.hpp>
@@ -474,12 +478,26 @@ template <class From> struct is_convertible_impl_dispatch<From, void volatile> :
} // namespace detail
template <class From, class To>
-struct is_convertible : public integral_constant<bool, ::boost::detail::is_convertible_impl_dispatch<From, To>::value> {};
+struct is_convertible : public integral_constant<bool, ::boost::detail::is_convertible_impl_dispatch<From, To>::value>
+{
+ BOOST_STATIC_ASSERT_MSG(boost::is_complete<To>::value || boost::is_void<To>::value || boost::is_array<To>::value, "Destination argument type to is_convertible must be a complete type");
+ BOOST_STATIC_ASSERT_MSG(boost::is_complete<From>::value || boost::is_void<From>::value || boost::is_array<From>::value, "From argument type to is_convertible must be a complete type");
+};
#else
template <class From, class To>
-struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)> {};
+struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)>
+{
+#if BOOST_WORKAROUND(BOOST_MSVC, <= 1900)
+ BOOST_STATIC_ASSERT_MSG(boost::is_complete<From>::value || boost::is_void<From>::value || boost::is_array<From>::value || boost::is_reference<From>::value, "From argument type to is_convertible must be a complete type");
+#endif
+#if defined(__clang__)
+ // clang's intrinsic doesn't assert on incomplete types:
+ BOOST_STATIC_ASSERT_MSG(boost::is_complete<To>::value || boost::is_void<To>::value || boost::is_array<To>::value, "Destination argument type to is_convertible must be a complete type");
+ BOOST_STATIC_ASSERT_MSG(boost::is_complete<From>::value || boost::is_void<From>::value || boost::is_array<From>::value, "From argument type to is_convertible must be a complete type");
+#endif
+};
#endif