diff --git a/include/boost/type_traits/detail/cv_traits_impl.hpp b/include/boost/type_traits/detail/cv_traits_impl.hpp index 3922b74..8e995bb 100644 --- a/include/boost/type_traits/detail/cv_traits_impl.hpp +++ b/include/boost/type_traits/detail/cv_traits_impl.hpp @@ -11,6 +11,7 @@ #ifndef BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED #define BOOST_TT_DETAIL_CV_TRAITS_IMPL_HPP_INCLUDED +#include #include #include @@ -21,6 +22,82 @@ namespace boost { namespace detail { +#if BOOST_WORKAROUND(BOOST_MSVC, == 1700) +#define BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(X) X + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type[]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type[]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type[]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type[]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type[N]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = false); + typedef T unqualified_type[N]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = false); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type[N]; + }; + + template + struct cv_traits_imp + { + BOOST_STATIC_CONSTANT(bool, is_const = true); + BOOST_STATIC_CONSTANT(bool, is_volatile = true); + typedef T unqualified_type[N]; + }; + +#else +#define BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(X) X * template struct cv_traits_imp {}; template @@ -30,9 +107,10 @@ struct cv_traits_imp BOOST_STATIC_CONSTANT(bool, is_volatile = false); typedef T unqualified_type; }; +#endif template -struct cv_traits_imp +struct cv_traits_imp { BOOST_STATIC_CONSTANT(bool, is_const = true); BOOST_STATIC_CONSTANT(bool, is_volatile = false); @@ -40,7 +118,7 @@ struct cv_traits_imp }; template -struct cv_traits_imp +struct cv_traits_imp { BOOST_STATIC_CONSTANT(bool, is_const = false); BOOST_STATIC_CONSTANT(bool, is_volatile = true); @@ -48,7 +126,7 @@ struct cv_traits_imp }; template -struct cv_traits_imp +struct cv_traits_imp { BOOST_STATIC_CONSTANT(bool, is_const = true); BOOST_STATIC_CONSTANT(bool, is_volatile = true); diff --git a/include/boost/type_traits/is_const.hpp b/include/boost/type_traits/is_const.hpp index 1a951bd..e3e62b6 100644 --- a/include/boost/type_traits/is_const.hpp +++ b/include/boost/type_traits/is_const.hpp @@ -54,7 +54,7 @@ struct is_const_rvalue_filter #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::type*>::is_const); #else - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_const); + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_const); #endif }; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES diff --git a/include/boost/type_traits/is_volatile.hpp b/include/boost/type_traits/is_volatile.hpp index 834b6f1..d9839da 100644 --- a/include/boost/type_traits/is_volatile.hpp +++ b/include/boost/type_traits/is_volatile.hpp @@ -41,7 +41,7 @@ struct is_volatile_rval_filter #if BOOST_WORKAROUND(BOOST_MSVC, < 1400) BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::type*>::is_volatile); #else - BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_volatile); + BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::cv_traits_imp::is_volatile); #endif }; #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES diff --git a/include/boost/type_traits/remove_const.hpp b/include/boost/type_traits/remove_const.hpp index 3499d0b..1020781 100644 --- a/include/boost/type_traits/remove_const.hpp +++ b/include/boost/type_traits/remove_const.hpp @@ -43,7 +43,7 @@ template struct remove_const_impl { typedef typename remove_const_helper< - typename cv_traits_imp::unqualified_type + typename cv_traits_imp::unqualified_type , ::boost::is_volatile::value >::type type; }; diff --git a/include/boost/type_traits/remove_volatile.hpp b/include/boost/type_traits/remove_volatile.hpp index 32ce114..c202776 100644 --- a/include/boost/type_traits/remove_volatile.hpp +++ b/include/boost/type_traits/remove_volatile.hpp @@ -42,7 +42,7 @@ template struct remove_volatile_impl { typedef typename remove_volatile_helper< - typename cv_traits_imp::unqualified_type + typename cv_traits_imp::unqualified_type , ::boost::is_const::value >::type type; }; diff --git a/test/remove_const_test.cpp b/test/remove_const_test.cpp index ff2987f..f386858 100644 --- a/test/remove_const_test.cpp +++ b/test/remove_const_test.cpp @@ -27,10 +27,27 @@ BOOST_DECL_TRANSFORM_TEST(remove_const_test_14, ::tt::remove_const, const volati BOOST_DECL_TRANSFORM_TEST(remove_const_test_15, ::tt::remove_const, [2], [2]) BOOST_DECL_TRANSFORM_TEST(remove_const_test_16, ::tt::remove_const, const*, const*) BOOST_DECL_TRANSFORM_TEST(remove_const_test_17, ::tt::remove_const, const*const, const*) +BOOST_DECL_TRANSFORM_TEST(remove_const_test_18, ::tt::remove_const, (*), (*)) +BOOST_DECL_TRANSFORM_TEST(remove_const_test_19, ::tt::remove_const, (*const), (*)) + +struct S +{ + template + typename boost::remove_const::type *operator=(T const &) const { return 0; } +}; + +void bar() {} + +void bug_case_7317() +{ + S s; + s = bar; + (void)s; +} TT_TEST_BEGIN(remove_const) -BOOST_CHECK_TYPE(int, int); + BOOST_CHECK_TYPE(int, int); remove_const_test_1(); remove_const_test_2(); @@ -47,6 +64,8 @@ BOOST_CHECK_TYPE(int, int); remove_const_test_15(); remove_const_test_16(); remove_const_test_17(); + remove_const_test_18(); + remove_const_test_19(); TT_TEST_END