diff --git a/include/boost/type_traits/has_new_operator.hpp b/include/boost/type_traits/has_new_operator.hpp index 731f7bf..6d5351e 100644 --- a/include/boost/type_traits/has_new_operator.hpp +++ b/include/boost/type_traits/has_new_operator.hpp @@ -85,7 +85,7 @@ namespace detail { BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(has_new_operator_impl::template check_sig(0))); BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(has_new_operator_impl::template check_sig2(0))); #else - #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif @@ -93,7 +93,7 @@ namespace detail { BOOST_STATIC_CONSTANT(unsigned, s1 = sizeof(check_sig(0))); BOOST_STATIC_CONSTANT(unsigned, s2 = sizeof(check_sig2(0))); - #if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) + #if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(pop) #endif #endif diff --git a/include/boost/type_traits/intrinsics.hpp b/include/boost/type_traits/intrinsics.hpp index 91ee88b..74b64a7 100644 --- a/include/boost/type_traits/intrinsics.hpp +++ b/include/boost/type_traits/intrinsics.hpp @@ -82,7 +82,7 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#if defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215) +#if defined(BOOST_MSVC) && defined(BOOST_MSVC_FULL_VER) && (BOOST_MSVC_FULL_VER >=140050215) # include # define BOOST_IS_UNION(T) __is_union(T) diff --git a/include/boost/type_traits/is_abstract.hpp b/include/boost/type_traits/is_abstract.hpp index a11718d..09fdf33 100644 --- a/include/boost/type_traits/is_abstract.hpp +++ b/include/boost/type_traits/is_abstract.hpp @@ -94,12 +94,12 @@ struct is_abstract_imp2 #ifdef __GNUC__ BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(is_abstract_imp2::template check_sig(0))); #else -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif BOOST_STATIC_CONSTANT(std::size_t, s1 = sizeof(check_sig(0))); -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(pop) #endif #endif diff --git a/include/boost/type_traits/is_base_and_derived.hpp b/include/boost/type_traits/is_base_and_derived.hpp index 8367b76..d6a9991 100644 --- a/include/boost/type_traits/is_base_and_derived.hpp +++ b/include/boost/type_traits/is_base_and_derived.hpp @@ -15,10 +15,10 @@ #include #include #include -#include #include #include #endif +#include // should be the last #include #include @@ -133,7 +133,7 @@ struct bd_helper template struct is_base_and_derived_impl2 { -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif @@ -156,7 +156,7 @@ struct is_base_and_derived_impl2 BOOST_STATIC_CONSTANT(bool, value = sizeof(bd_helper::check_sig(Host(), 0)) == sizeof(type_traits::yes_type)); -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(pop) #endif }; @@ -212,7 +212,7 @@ struct is_base_and_derived_impl typedef is_base_and_derived_select< ::boost::is_class::value, ::boost::is_class::value, - ::boost::is_same::value> selector; + ::boost::is_same::value> selector; typedef typename selector::template rebind binder; typedef typename binder::type bound_type; @@ -222,7 +222,10 @@ struct is_base_and_derived_impl template struct is_base_and_derived_impl { - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_BASE_OF(B,D)); + typedef typename remove_cv::type ncvB; + typedef typename remove_cv::type ncvD; + + BOOST_STATIC_CONSTANT(bool, value = (BOOST_IS_BASE_OF(B,D) && ! ::boost::is_same::value)); }; #endif } // namespace detail diff --git a/include/boost/type_traits/is_base_of.hpp b/include/boost/type_traits/is_base_of.hpp old mode 100755 new mode 100644 index bf46da3..0cc7a32 --- a/include/boost/type_traits/is_base_of.hpp +++ b/include/boost/type_traits/is_base_of.hpp @@ -11,21 +11,32 @@ #include #include +#include #include +#include // should be the last #include #include namespace boost { + namespace detail{ + template + struct is_base_of_imp + { + typedef typename remove_cv::type ncvB; + typedef typename remove_cv::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl::value), + (::boost::type_traits::ice_and< ::boost::is_same::value, ::boost::is_class::value>::value)>::value)); + }; + } + BOOST_TT_AUX_BOOL_TRAIT_DEF2( is_base_of , Base , Derived - , (::boost::type_traits::ice_or< - (::boost::detail::is_base_and_derived_impl::value), - (::boost::is_same::value)>::value) - ) + , (::boost::detail::is_base_of_imp::value)) #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) diff --git a/include/boost/type_traits/is_base_of_tr1.hpp b/include/boost/type_traits/is_base_of_tr1.hpp new file mode 100644 index 0000000..177e62b --- /dev/null +++ b/include/boost/type_traits/is_base_of_tr1.hpp @@ -0,0 +1,50 @@ + +// (C) Copyright Rani Sharoni 2003-2005. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED +#define BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED + +#include +#include +#include +#include + +// should be the last #include +#include + +namespace boost { namespace tr1{ + + namespace detail{ + template + struct is_base_of_imp + { + typedef typename remove_cv::type ncvB; + typedef typename remove_cv::type ncvD; + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< + (::boost::detail::is_base_and_derived_impl::value), + (::boost::is_same::value)>::value)); + }; + } + +BOOST_TT_AUX_BOOL_TRAIT_DEF2( + is_base_of + , Base + , Derived + , (::boost::tr1::detail::is_base_of_imp::value)) + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base,Derived&,false) +BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(typename Base,typename Derived,is_base_of,Base&,Derived&,false) +#endif + +} } // namespace boost + +#include + +#endif // BOOST_TT_IS_BASE_OF_TR1_HPP_INCLUDED diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index ce522a0..a31a930 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -256,7 +256,7 @@ struct is_convertible_basic_impl #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4244) -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(disable:6334) #endif #endif diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index 1fba1bd..95dba0d 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -65,7 +65,7 @@ struct is_function_impl template struct is_function_impl { -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif @@ -74,7 +74,7 @@ struct is_function_impl bool, value = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type) ); -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(pop) #endif }; diff --git a/include/boost/type_traits/is_member_function_pointer.hpp b/include/boost/type_traits/is_member_function_pointer.hpp index 3fff063..81f1eac 100644 --- a/include/boost/type_traits/is_member_function_pointer.hpp +++ b/include/boost/type_traits/is_member_function_pointer.hpp @@ -64,7 +64,7 @@ struct is_mem_fun_pointer_select { template struct result_ { -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(push) #pragma warning(disable:6334) #endif @@ -75,7 +75,7 @@ struct is_mem_fun_pointer_select bool, value = ( 1 == sizeof(::boost::type_traits::is_mem_fun_pointer_tester(self_type::make_t)) )); -#if BOOST_WORKAROUND(_MSC_FULL_VER, >= 140050000) +#if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) #pragma warning(pop) #endif }; diff --git a/include/boost/type_traits/is_member_pointer.hpp b/include/boost/type_traits/is_member_pointer.hpp index cdf3d6a..ba02b89 100644 --- a/include/boost/type_traits/is_member_pointer.hpp +++ b/include/boost/type_traits/is_member_pointer.hpp @@ -50,7 +50,7 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer, BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_member_pointer,T,::boost::is_member_function_pointer::value) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*,true) -#if !BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#if !BOOST_WORKAROUND(__MWERKS__,<=0x3003) && !BOOST_WORKAROUND(__IBMCPP__, <=600) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const,true) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*volatile,true) BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(typename T,typename U,is_member_pointer,U T::*const volatile,true) diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp index 73389a1..e06b47c 100644 --- a/include/boost/type_traits/is_signed.hpp +++ b/include/boost/type_traits/is_signed.hpp @@ -30,7 +30,7 @@ template struct is_signed_helper { typedef typename remove_cv::type no_cv_t; - BOOST_STATIC_CONSTANT(bool, value = (static_cast(-1) < 0)); + BOOST_STATIC_CONSTANT(bool, value = (!(static_cast(-1) > 0))); }; template diff --git a/include/boost/type_traits/is_virtual_base_of.hpp b/include/boost/type_traits/is_virtual_base_of.hpp index e3dd441..30b34f6 100644 --- a/include/boost/type_traits/is_virtual_base_of.hpp +++ b/include/boost/type_traits/is_virtual_base_of.hpp @@ -42,14 +42,14 @@ struct is_virtual_base_of_impl X(); X(const X&); X& operator=(const X&); - ~X(); + ~X()throw(); }; struct Y : public virtual Derived { Y(); Y(const Y&); Y& operator=(const Y&); - ~Y(); + ~Y()throw(); }; #else struct X : Derived, virtual Base @@ -57,14 +57,14 @@ struct is_virtual_base_of_impl X(); X(const X&); X& operator=(const X&); - ~X(); + ~X()throw(); }; struct Y : Derived { Y(); Y(const Y&); Y& operator=(const Y&); - ~Y(); + ~Y()throw(); }; #endif BOOST_STATIC_CONSTANT(bool, value = (sizeof(X)==sizeof(Y))); diff --git a/test/is_base_and_derived_test.cpp b/test/is_base_and_derived_test.cpp index bb215d9..38e8fa3 100644 --- a/test/is_base_and_derived_test.cpp +++ b/test/is_base_and_derived_test.cpp @@ -30,6 +30,7 @@ TT_TEST_BEGIN(is_base_and_derived) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); @@ -40,8 +41,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), fal BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); +#if defined(TEST_STD) && (TEST_STD < 2006) +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); +#else BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); +#endif BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_and_derived::value), true); diff --git a/test/is_base_of_test.cpp b/test/is_base_of_test.cpp index 6817ffb..86c5754 100644 --- a/test/is_base_of_test.cpp +++ b/test/is_base_of_test.cpp @@ -19,8 +19,11 @@ TT_TEST_BEGIN(is_base_of) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); @@ -30,8 +33,13 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); -BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); // really it is!!!!! +#if defined(TEST_STD) && (TEST_STD < 2006) +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); +#else +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); +#endif BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); diff --git a/test/is_virtual_base_of_test.cpp b/test/is_virtual_base_of_test.cpp index 4e33714..84ba744 100644 --- a/test/is_virtual_base_of_test.cpp +++ b/test/is_virtual_base_of_test.cpp @@ -9,6 +9,21 @@ #include "check_integral_constant.hpp" #include +// for bug report 3317: https://svn.boost.org/trac/boost/ticket/3317 +class B +{ +public: + B(); + virtual ~B()throw(); +}; + +class D : public B +{ +public: + D(); + virtual ~D()throw(); +}; + TT_TEST_BEGIN(is_virtual_base_of) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); @@ -42,6 +57,9 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), true); BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), true); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of::value), false); TT_TEST_END diff --git a/test/test.hpp b/test/test.hpp index 8916078..47c3333 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -370,6 +370,7 @@ struct virtual_inherit2 : virtual_inherit1 { }; struct virtual_inherit3 : private virtual Base {}; struct virtual_inherit4 : virtual boost::noncopyable {}; struct virtual_inherit5 : virtual int_convertible {}; +struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); }; typedef void foo0_t(); typedef void foo1_t(int); diff --git a/test/tricky_function_type_test.cpp b/test/tricky_function_type_test.cpp index c029a55..30ba24c 100644 --- a/test/tricky_function_type_test.cpp +++ b/test/tricky_function_type_test.cpp @@ -39,7 +39,11 @@ BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_constructor::value, fals BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_copy::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_assign::value, false); BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_destructor::value, false); +#if defined(TEST_STD) && (TEST_STD < 2006) BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), true); // TR1 required behaviour (new to 1.34) +#else +BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_base_of::value), false); // C++0x required behaviour (new to 1.40) +#endif BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_convertible::value), false);