Assert completeness fixes: fix up msvc failures.

This commit is contained in:
jzmaddock
2018-02-04 18:15:34 +00:00
parent bfb6384a0a
commit 0886e13a99
6 changed files with 24 additions and 5 deletions

View File

@ -27,6 +27,12 @@
namespace boost {
//
// We will undef this if the trait isn't fully functional:
//
#define BOOST_TT_HAS_WORKING_IS_COMPLETE
#if !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_MSVC, <= 1900)
namespace detail{
@ -74,6 +80,8 @@ namespace boost {
template <class T> struct is_complete
: public integral_constant<bool, true> {};
#undef BOOST_TT_HAS_WORKING_IS_COMPLETE
#endif
} // namespace boost

View File

@ -489,7 +489,10 @@ struct is_convertible : public integral_constant<bool, ::boost::detail::is_conve
template <class From, class To>
struct is_convertible : public integral_constant<bool, BOOST_IS_CONVERTIBLE(From, To)>
{
#ifdef __clang__
#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");

View File

@ -7,6 +7,10 @@
# include <boost/type_traits/is_assignable.hpp>
#include "../test.hpp"
#ifndef BOOST_TT_HAS_WORKING_IS_COMPLETE
#error "Sorry can't test this."
#endif
int main()
{
return boost::is_assignable<incomplete_type>::value;

View File

@ -7,8 +7,8 @@
# include <boost/type_traits/is_convertible.hpp>
#include "../test.hpp"
#if defined(CI_SUPPRESS_KNOWN_ISSUES) && defined(BOOST_MSVC) && (BOOST_MSVC <= 1800)
#error "Sorry check doesn't work"
#ifndef BOOST_TT_HAS_WORKING_IS_COMPLETE
#error "Sorry can't test this."
#endif
int main()

View File

@ -7,6 +7,10 @@
# include <boost/type_traits/is_list_constructible.hpp>
#include "../test.hpp"
#ifndef BOOST_TT_HAS_WORKING_IS_COMPLETE
#error "Sorry can't test this."
#endif
int main()
{
return boost::is_list_constructible<incomplete_type>::value;

View File

@ -31,7 +31,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int[2]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const[3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int volatile[2][3]>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int const volatile[4][5][6]>::value, true);
#ifndef BOOST_NO_SFINAE
#ifdef BOOST_TT_HAS_WORKING_IS_COMPLETE
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<int[]>::value, false);
#endif
@ -43,7 +43,7 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<cmf>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<mf8>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<union_UDT>::value, true);
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<test_abc1>::value, true);
#ifndef BOOST_NO_SFINAE
#ifdef BOOST_TT_HAS_WORKING_IS_COMPLETE
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<incomplete_type>::value, false);
#endif
BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_complete<polymorphic_base>::value, true);