From 9994e68bc86d07e77139da9bbe390044b3c24464 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 14 Mar 2002 02:20:40 +0000 Subject: [PATCH] Many fixes for MSVC6, esp. with ABCs [SVN r13188] --- include/boost/type_traits/array_traits.hpp | 85 ++++++ .../boost/type_traits/composite_traits.hpp | 289 +++++++----------- include/boost/type_traits/cv_traits.hpp | 107 ++++++- .../boost/type_traits/reference_traits.hpp | 90 ++++++ include/boost/type_traits/utility.hpp | 24 ++ tests/composite_traits_test.cpp | 6 - tests/cv_traits_test.cpp | 6 +- tests/transform_traits_test.cpp | 20 +- 8 files changed, 416 insertions(+), 211 deletions(-) create mode 100644 include/boost/type_traits/array_traits.hpp create mode 100644 include/boost/type_traits/reference_traits.hpp create mode 100644 include/boost/type_traits/utility.hpp diff --git a/include/boost/type_traits/array_traits.hpp b/include/boost/type_traits/array_traits.hpp new file mode 100644 index 0000000..04f8488 --- /dev/null +++ b/include/boost/type_traits/array_traits.hpp @@ -0,0 +1,85 @@ +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# define BOOST_TT_ARRAY_TRAITS_HPP +# include + +namespace boost { + +/********************************************** + * + * is_array + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_array +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace detail +{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + using ::boost::type_traits::wrap; + + template T(* is_array_helper1(wrap) )(wrap); + char is_array_helper1(...); + + template no_type is_array_helper2(T(*)(wrap)); + yes_type is_array_helper2(...); +} + +template +struct is_array +{ +public: + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_array_helper2( + ::boost::detail::is_array_helper1( + ::boost::type_traits::wrap()))) == 1 + ); +}; + +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +# ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +template <> +struct is_array +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +# endif +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + +} // namespace boost + +#endif // BOOST_TT_ARRAY_TRAITS_HPP diff --git a/include/boost/type_traits/composite_traits.hpp b/include/boost/type_traits/composite_traits.hpp index 6baf895..01aab6d 100644 --- a/include/boost/type_traits/composite_traits.hpp +++ b/include/boost/type_traits/composite_traits.hpp @@ -1,8 +1,9 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. // // See http://www.boost.org for most recent version including documentation. // @@ -27,43 +28,33 @@ #define BOOST_COMPOSITE_TYPE_TRAITS_HPP #ifndef BOOST_ICE_TYPE_TRAITS_HPP -#include +# include #endif #ifndef BOOST_FWD_TYPE_TRAITS_HPP -#include +# include #endif #ifndef BOOST_CONVERSION_TYPE_TRAITS_HPP -#include +# include #endif #ifndef BOOST_CV_TYPE_TRAITS_HPP -#include +# include #endif #ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP -#include +# include #endif #ifndef BOOST_TRANSFORM_TRAITS_HPP -#include +# include #endif +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# include +#endif namespace boost{ -/********************************************** - * - * is_array - * - **********************************************/ -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template struct is_array -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template struct is_array -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template struct is_array -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template struct is_array -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template struct is_array -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail{ struct pointer_helper @@ -137,55 +128,21 @@ template ::boost::type_traits::yes_type is_function_tester(R (*)(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16, A17, A18, A19, A20, A21, A22, A23, A24, A25, A26, A27, A28, A29)); } // namespace detail +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION namespace detail { - template struct wrap {}; - - template T(* is_array_helper1(wrap) )(wrap); - char is_array_helper1(...); - - template no_type is_array_helper2(T(*)(wrap)); - yes_type is_array_helper2(...); + // Utility metafunction which returns true if its argument is not an + // array and not a reference. + template + struct neither_array_nor_reference : ::boost::type_traits::ice_not< + ::boost::type_traits::ice_or< + ::boost::is_reference::value + , ::boost::is_array::value + >::value> + {}; } -template -struct is_array -{ -public: - BOOST_STATIC_CONSTANT( - bool, value = sizeof( - ::boost::detail::is_array_helper2( - ::boost::detail::is_array_helper1( - ::boost::detail::wrap()))) == 1 - ); -}; - -template <> -struct is_array -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> -struct is_array -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template <> -struct is_array -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -template <> -struct is_array -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#endif - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - /********************************************** * * is_pointer @@ -207,26 +164,37 @@ template struct is_pointer_helper template struct is_pointer { BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< ::boost::detail::is_pointer_helper::value, ::boost::type_traits::ice_not< ::boost::is_member_pointer::value >::value >::value)); }; #else -template -struct is_pointer -{ -private: - static T t; -public: - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_and< - ::boost::type_traits::ice_not< - ::boost::is_reference::value - >::value, - ::boost::type_traits::ice_not< - ::boost::is_array::value - >::value, + +namespace detail +{ + // is_pointer implementation + template + struct is_pointer_select : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_pointer_select + { + template + struct apply + { + static T& make_t(); + BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< - (1 == sizeof(detail::is_pointer_helper(t))), - (1 == sizeof(detail::is_function_tester(t))) - >::value) - >::value ) ); -}; + (1 == sizeof(is_pointer_helper(make_t()))), + (1 == sizeof(is_function_tester(make_t()))) + >::value)); + }; + }; +} + +template +struct is_pointer : ::boost::detail::is_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + template <> struct is_pointer { @@ -251,71 +219,6 @@ struct is_pointer #endif #endif -/********************************************** - * - * is_reference - * - **********************************************/ -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -#if defined(__BORLANDC__) -// these are illegal specialisations; cv-qualifies applied to -// references have no effect according to [8.3.2p1], -// C++ Builder requires them though as it treats cv-qualified -// references as distinct types... -template struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -template struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = true); }; -#endif -#else -# ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable: 4181) -#endif // BOOST_MSVC - -namespace detail -{ - template T&(* is_reference_helper1(wrap) )(wrap); - char is_reference_helper1(...); - - template no_type is_reference_helper2(T&(*)(wrap)); - yes_type is_reference_helper2(...); -} - -template -struct is_reference -{ - BOOST_STATIC_CONSTANT( - bool, value = sizeof( - ::boost::detail::is_reference_helper2( - ::boost::detail::is_reference_helper1(::boost::detail::wrap()))) == 1 - ); -}; - -template <> struct is_reference -{ - BOOST_STATIC_CONSTANT(bool, value = false); -}; -#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS -template <> struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <> struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -template <> struct is_reference -{ BOOST_STATIC_CONSTANT(bool, value = false); }; -#endif - -# ifdef BOOST_MSVC -# pragma warning(pop) -# endif // BOOST_MSVC -#endif - /********************************************** * * is_union @@ -936,14 +839,35 @@ template ::boost::type_traits::no_type BOOST_TT_DECL is_member_pointer_helper(...); } -template -struct is_member_function_pointer + +namespace detail { -private: - static T t; -public: - BOOST_STATIC_CONSTANT(bool, value = (1 == sizeof(detail::is_member_function_pointer_helper(t))) ); -}; + template + struct is_member_function_pointer_select + : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_member_function_pointer_select + { + template + struct apply + { + static T& make_t(); + + BOOST_STATIC_CONSTANT( + bool, value = (1 == sizeof(detail::is_member_function_pointer_helper(make_t()))) ); + }; + }; +} + +template +struct is_member_function_pointer : ::boost::detail::is_member_function_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + template <> struct is_member_function_pointer { @@ -972,16 +896,37 @@ template struct is_member_pointer template struct is_member_pointer { BOOST_STATIC_CONSTANT(bool, value = true); }; #else -template -struct is_member_pointer + +namespace detail { -private: - static T t; -public: - BOOST_STATIC_CONSTANT(bool, value = - (1 == sizeof(detail::is_member_function_pointer_helper(t))) - || (1 == sizeof(detail::is_member_pointer_helper(t))) ); -}; + template + struct is_member_pointer_select + : ::boost::type_traits::false_unary_metafunction + { + }; + + template <> + struct is_member_pointer_select + { + template + struct apply + { + static T& make_t(); + + BOOST_STATIC_CONSTANT( + bool, value = ( + 1 == sizeof(detail::is_member_function_pointer_helper(make_t()))) + || (1 == sizeof(detail::is_member_pointer_helper(make_t()))) ); + }; + }; +} + +template +struct is_member_pointer : ::boost::detail::is_member_pointer_select< + ::boost::detail::neither_array_nor_reference::value +>::template apply +{}; + template <> struct is_member_pointer { diff --git a/include/boost/type_traits/cv_traits.hpp b/include/boost/type_traits/cv_traits.hpp index 0df7118..1644cc7 100644 --- a/include/boost/type_traits/cv_traits.hpp +++ b/include/boost/type_traits/cv_traits.hpp @@ -1,8 +1,9 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Permission to copy, use, modify, sell and -// distribute this software is granted provided this copyright notice appears -// in all copies. This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. +// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000. Permission to copy, use, modify, +// sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. // // See http://www.boost.org for most recent version including documentation. // @@ -22,6 +23,15 @@ #ifndef BOOST_FWD_TYPE_TRAITS_HPP #include #endif +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_ARRAY_TRAITS_HPP +# include +#endif +#ifndef BOOST_TT_UTILITY_HPP +# include +#endif namespace boost{ @@ -179,13 +189,47 @@ namespace detail{ no_type is_volatile_helper(const void *); } +namespace detail +{ + template + struct is_const_impl + : ::boost::type_traits::false_unary_metafunction + {}; + + template <> + struct is_const_impl + { + template + struct apply + { + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(t)))); + }; + }; + + template <> + struct is_const_impl + { + template + struct apply + { + private: + static T t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(&t)))); + }; + }; +} + template struct is_const + : ::boost::detail::is_const_impl< + is_reference::value + , is_array::value + >::template apply { -private: - static T t; -public: - BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_const_helper(&t)))); }; template <> @@ -211,15 +255,50 @@ struct is_const }; #endif +namespace detail +{ + template + struct is_volatile_impl + : ::boost::type_traits::false_unary_metafunction + {}; + + template <> + struct is_volatile_impl + { + template + struct apply + { + private: + static T* t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(t)))); + }; + }; + + template <> + struct is_volatile_impl + { + template + struct apply + { + private: + static T t; + public: + BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(&t)))); + }; + }; +} + template struct is_volatile -{ -private: - static T t; -public: - BOOST_STATIC_CONSTANT(bool, value = (sizeof(detail::yes_type) == sizeof(detail::is_volatile_helper(&t)))); + : ::boost::detail::is_volatile_impl< + is_reference::value + , is_array::value + >::template apply +{ }; + template <> struct is_volatile { diff --git a/include/boost/type_traits/reference_traits.hpp b/include/boost/type_traits/reference_traits.hpp new file mode 100644 index 0000000..b9df72a --- /dev/null +++ b/include/boost/type_traits/reference_traits.hpp @@ -0,0 +1,90 @@ +// (C) Copyright David Abrahams Steve Cleary, Beman Dawes, Howard +// Hinnant & John Maddock 2000-2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +// +// See http://www.boost.org for most recent version including documentation. +// +#ifndef BOOST_TT_REFERENCE_TRAITS_HPP +# define BOOST_TT_REFERENCE_TRAITS_HPP + +# ifndef BOOST_TT_UTILITY_HPP +# include +# endif // BOOST_TT_UTILITY_HPP + +namespace boost { + +/********************************************** + * + * is_reference + * + **********************************************/ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#if defined(__BORLANDC__) +// these are illegal specialisations; cv-qualifies applied to +// references have no effect according to [8.3.2p1], +// C++ Builder requires them though as it treats cv-qualified +// references as distinct types... +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +template struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = true); }; +#endif +#else +# ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4181) +#endif // BOOST_MSVC + +namespace detail +{ + using ::boost::type_traits::yes_type; + using ::boost::type_traits::no_type; + using ::boost::type_traits::wrap; + + template T&(* is_reference_helper1(wrap) )(wrap); + char is_reference_helper1(...); + + template no_type is_reference_helper2(T&(*)(wrap)); + yes_type is_reference_helper2(...); +} + +template +struct is_reference +{ + BOOST_STATIC_CONSTANT( + bool, value = sizeof( + ::boost::detail::is_reference_helper2( + ::boost::detail::is_reference_helper1(::boost::type_traits::wrap()))) == 1 + ); +}; + +template <> struct is_reference +{ + BOOST_STATIC_CONSTANT(bool, value = false); +}; +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +template <> struct is_reference +{ BOOST_STATIC_CONSTANT(bool, value = false); }; +#endif + +# ifdef BOOST_MSVC +# pragma warning(pop) +# endif // BOOST_MSVC +#endif + +} // namespace boost::type_traits + +#endif // BOOST_TT_REFERENCE_TRAITS_HPP diff --git a/include/boost/type_traits/utility.hpp b/include/boost/type_traits/utility.hpp new file mode 100644 index 0000000..a51c2d9 --- /dev/null +++ b/include/boost/type_traits/utility.hpp @@ -0,0 +1,24 @@ +// Copyright David Abrahams 2002. Permission to copy, use, +// modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided +// "as is" without express or implied warranty, and with no claim as +// to its suitability for any purpose. +#ifndef BOOST_TT_UTILITY_HPP +# define BOOST_TT_UTILITY_HPP + +namespace boost { namespace type_traits +{ + // Utility metafunction class which always returns false + struct false_unary_metafunction + { + template + struct apply + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + }; + + template struct wrap {}; +}} // namespace boost::type_traits + +#endif // BOOST_TT_UTILITY_HPP diff --git a/tests/composite_traits_test.cpp b/tests/composite_traits_test.cpp index 393b312..9589284 100644 --- a/tests/composite_traits_test.cpp +++ b/tests/composite_traits_test.cpp @@ -79,9 +79,7 @@ int cpp_main(int argc, char* argv[]) value_test(false, boost::is_pointer::value) value_test(false, boost::is_pointer::value) value_test(false, boost::is_pointer::value) -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION value_test(false, boost::is_pointer::value) -#endif value_test(false, boost::is_reference::value) value_test(true, boost::is_reference::value) @@ -105,9 +103,7 @@ int cpp_main(int argc, char* argv[]) value_test(true, boost::is_member_pointer::value) value_test(true, boost::is_member_pointer::value) value_test(false, boost::is_member_pointer::value) -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) value_test(false, boost::is_member_pointer::value) -#endif value_test(false, boost::is_member_function_pointer::value) value_test(false, boost::is_member_function_pointer::value) @@ -120,9 +116,7 @@ int cpp_main(int argc, char* argv[]) value_test(true, boost::is_member_function_pointer::value) value_test(false, boost::is_member_function_pointer::value) value_test(false, boost::is_member_function_pointer::value) -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__BORLANDC__) value_test(false, boost::is_member_function_pointer::value) -#endif value_test(false, boost::is_enum::value) value_test(true, boost::is_enum::value) diff --git a/tests/cv_traits_test.cpp b/tests/cv_traits_test.cpp index 904cef5..86caa3d 100644 --- a/tests/cv_traits_test.cpp +++ b/tests/cv_traits_test.cpp @@ -27,10 +27,8 @@ int cpp_main(int argc, char* argv[]) value_test(false, boost::is_const::value) value_test(true, boost::is_const::value) -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC) value_test(false, boost::is_const::value) value_test(true, boost::is_const::value) -#endif value_test(false, boost::is_const::value) value_test(true, boost::is_const::value) value_test(true, boost::is_const::value) @@ -45,10 +43,8 @@ int cpp_main(int argc, char* argv[]) value_test(false, boost::is_volatile::value) value_test(true, boost::is_volatile::value) -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC) value_test(false, boost::is_volatile::value) value_test(true, boost::is_volatile::value) -#endif value_test(false, boost::is_volatile::value) value_test(true, boost::is_volatile::value) value_test(true, boost::is_volatile::value) @@ -60,7 +56,7 @@ int cpp_main(int argc, char* argv[]) // // define the number of failures expected for given compilers: #ifdef BOOST_MSVC -unsigned int expected_failures = 3; +unsigned int expected_failures = 2; #elif defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x530) unsigned int expected_failures = 1; #else diff --git a/tests/transform_traits_test.cpp b/tests/transform_traits_test.cpp index eeb740f..2c76290 100644 --- a/tests/transform_traits_test.cpp +++ b/tests/transform_traits_test.cpp @@ -365,14 +365,12 @@ BOOST_DECL_TRANSFORM_TEST(add_const_test_3, ::boost::add_const, *, *const) BOOST_DECL_TRANSFORM_TEST(add_const_test_7, ::boost::add_const, *volatile, *volatile const) BOOST_DECL_TRANSFORM_TEST(add_const_test_10, ::boost::add_const, const*, const*const) BOOST_DECL_TRANSFORM_TEST(add_const_test_11, ::boost::add_const, volatile*, volatile*const) -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_DECL_TRANSFORM_TEST(add_const_test_5, ::boost::add_const, const &, const&) BOOST_DECL_TRANSFORM_TEST(add_const_test_6, ::boost::add_const, &, &) BOOST_DECL_TRANSFORM_TEST(add_const_test_8, ::boost::add_const, const [2], const [2]) BOOST_DECL_TRANSFORM_TEST(add_const_test_9, ::boost::add_const, volatile &, volatile&) BOOST_DECL_TRANSFORM_TEST(add_const_test_12, ::boost::add_const, [2][3], const[2][3]) BOOST_DECL_TRANSFORM_TEST(add_const_test_13, ::boost::add_const, (&)[2], (&)[2]) -#endif void check_add_const() { @@ -383,14 +381,12 @@ void check_add_const() add_const_test_7(); add_const_test_10(); add_const_test_11(); -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION add_const_test_5(); add_const_test_6(); add_const_test_8(); add_const_test_9(); add_const_test_12(); add_const_test_13(); -#endif } /*********************************************************************** @@ -406,14 +402,12 @@ BOOST_DECL_TRANSFORM_TEST(add_volatile_test_3, ::boost::add_volatile, *, *volati BOOST_DECL_TRANSFORM_TEST(add_volatile_test_7, ::boost::add_volatile, *volatile, *volatile) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_10, ::boost::add_volatile, const*, const*volatile) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_11, ::boost::add_volatile, volatile*, volatile*volatile) -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_DECL_TRANSFORM_TEST(add_volatile_test_5, ::boost::add_volatile, const &, const&) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_6, ::boost::add_volatile, &, &) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_8, ::boost::add_volatile, const [2], const volatile [2]) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_9, ::boost::add_volatile, volatile &, volatile&) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_12, ::boost::add_volatile, [2][3], volatile[2][3]) BOOST_DECL_TRANSFORM_TEST(add_volatile_test_13, ::boost::add_volatile, (&)[2], (&)[2]) -#endif void check_add_volatile() { @@ -424,14 +418,12 @@ void check_add_volatile() add_volatile_test_7(); add_volatile_test_10(); add_volatile_test_11(); -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION add_volatile_test_5(); add_volatile_test_6(); add_volatile_test_8(); add_volatile_test_9(); add_volatile_test_12(); add_volatile_test_13(); -#endif } @@ -464,21 +456,21 @@ int cpp_main(int argc, char* argv[]) // // define the number of failures expected for given compilers: #ifdef __BORLANDC__ -#ifdef SHORT_TRANSFORM_TEST +# ifdef SHORT_TRANSFORM_TEST unsigned int expected_failures = 97; // cv-qualifiers -#else +# else unsigned int expected_failures = 474; // cv-qualifiers -#endif +# endif #elif defined(BOOST_MSVC) unsigned int expected_failures = 84; // partial specialisation (fails for UDT's) #elif defined(__SUNPRO_CC) unsigned int expected_failures = 1; // cv-qualified references #elif defined(__GNUC__) -#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) +# if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) unsigned int expected_failures = 0; -#else +# else unsigned int expected_failures = 1; // cv-qualified references -#endif +# endif #elif defined(__HP_aCC) unsigned int expected_failures = 272; // remove_const/remove_volatile/remove_cv don't work #elif defined(__EDG_VERSION__) && __EDG_VERSION__ < 238