From 2f3fecf3f5e3b8415e19a483d5fcf2807eef1e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sat, 19 Sep 2015 22:27:38 +0200 Subject: [PATCH] First patches for MSVC-7.1 --- .../detail/composite_pointer_type.hpp | 6 ++++-- .../type_traits/detail/has_binary_operator.hpp | 5 ++++- .../detail/has_postfix_operator.hpp | 5 ++++- .../type_traits/detail/has_prefix_operator.hpp | 7 ++++++- include/boost/type_traits/is_convertible.hpp | 18 ++++++++++++++++-- include/boost/type_traits/is_signed.hpp | 4 +++- include/boost/type_traits/is_unsigned.hpp | 4 +++- 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/include/boost/type_traits/detail/composite_pointer_type.hpp b/include/boost/type_traits/detail/composite_pointer_type.hpp index c807954..f3edb5e 100644 --- a/include/boost/type_traits/detail/composite_pointer_type.hpp +++ b/include/boost/type_traits/detail/composite_pointer_type.hpp @@ -128,13 +128,15 @@ public: template struct composite_pointer_type { + //Done in two steps to avoid compilation errors + //in old compilers like MSVC 7.1 typedef typename boost::conditional< detail::has_common_pointee::value, detail::common_pointee, detail::composite_pointer_impl - - >::type::type * type; + >::type first_type; + typename first_type::type * type; }; } // namespace type_traits_detail diff --git a/include/boost/type_traits/detail/has_binary_operator.hpp b/include/boost/type_traits/detail/has_binary_operator.hpp index 7bc783a..039a6bb 100644 --- a/include/boost/type_traits/detail/has_binary_operator.hpp +++ b/include/boost/type_traits/detail/has_binary_operator.hpp @@ -37,7 +37,10 @@ # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 6334) +# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif namespace boost { diff --git a/include/boost/type_traits/detail/has_postfix_operator.hpp b/include/boost/type_traits/detail/has_postfix_operator.hpp index 2a6c706..3e686f1 100644 --- a/include/boost/type_traits/detail/has_postfix_operator.hpp +++ b/include/boost/type_traits/detail/has_postfix_operator.hpp @@ -23,7 +23,10 @@ # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4244 4913 6334) +# pragma warning ( disable : 4244 4913) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif namespace boost { diff --git a/include/boost/type_traits/detail/has_prefix_operator.hpp b/include/boost/type_traits/detail/has_prefix_operator.hpp index 72279e7..d4574fc 100644 --- a/include/boost/type_traits/detail/has_prefix_operator.hpp +++ b/include/boost/type_traits/detail/has_prefix_operator.hpp @@ -31,9 +31,14 @@ # pragma GCC system_header #elif defined(BOOST_MSVC) # pragma warning ( push ) -# pragma warning ( disable : 4146 4804 4913 4244 6334) +# pragma warning ( disable : 4146 4804 4913 4244) +# if BOOST_WORKAROUND(BOOST_MSVC_FULL_VER, >= 140050000) +# pragma warning ( disable : 6334) +# endif #endif + + namespace boost { namespace detail { diff --git a/include/boost/type_traits/is_convertible.hpp b/include/boost/type_traits/is_convertible.hpp index bc11a59..417ece2 100644 --- a/include/boost/type_traits/is_convertible.hpp +++ b/include/boost/type_traits/is_convertible.hpp @@ -300,13 +300,26 @@ struct is_convertible_basic_impl: // This version seems to work pretty well for a wide spectrum of compilers, // however it does rely on undefined behaviour by passing UDT's through (...). // + +//Workaround for old compilers like MSVC 7.1 to avoid +//forming a reference to an array of unknown bound +template +struct is_convertible_basic_impl_add_lvalue_reference + : add_lvalue_reference +{}; + +template +struct is_convertible_basic_impl_add_lvalue_reference +{ + typedef From type []; +}; + template struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); - typedef typename add_lvalue_reference::type lvalue_type; - typedef typename add_rvalue_reference::type rvalue_type; + typedef typename is_convertible_basic_impl_add_lvalue_reference::type lvalue_type; static lvalue_type _m_from; #ifdef BOOST_MSVC #pragma warning(push) @@ -316,6 +329,7 @@ struct is_convertible_basic_impl #endif #endif #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + typedef typename add_rvalue_reference::type rvalue_type; BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(static_cast(_m_from)) ) == sizeof(::boost::type_traits::yes_type) ); diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp index 48facd3..70ca2e4 100644 --- a/include/boost/type_traits/is_signed.hpp +++ b/include/boost/type_traits/is_signed.hpp @@ -19,7 +19,9 @@ namespace boost { #if !defined( __CODEGEARC__ ) -#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) && !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) && \ + !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\ + !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) namespace detail{ diff --git a/include/boost/type_traits/is_unsigned.hpp b/include/boost/type_traits/is_unsigned.hpp index 309f3ed..c4c54af 100644 --- a/include/boost/type_traits/is_unsigned.hpp +++ b/include/boost/type_traits/is_unsigned.hpp @@ -20,7 +20,9 @@ namespace boost { #if !defined( __CODEGEARC__ ) -#if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) && !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) +#if !(defined(BOOST_MSVC) && BOOST_MSVC <= 1310) &&\ + !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) &&\ + !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) namespace detail{