From 1677adf4624b9990e1fec8ede3c73c406cc40272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20J=C3=A4rvi?= Date: Wed, 3 Dec 2003 19:26:15 +0000 Subject: [PATCH] Added BOOST_NO_SFINAE config macro, removed internal version from the iterator library [SVN r21125] --- include/boost/config/compiler/borland.hpp | 1 + include/boost/config/compiler/gcc.hpp | 4 ++ include/boost/config/compiler/metrowerks.hpp | 4 ++ include/boost/config/compiler/visualc.hpp | 1 + test/boost_no_sfinae.ipp | 68 ++++++++++++++++++++ test/config_info.cpp | 1 + 6 files changed, 79 insertions(+) create mode 100644 test/boost_no_sfinae.ipp diff --git a/include/boost/config/compiler/borland.hpp b/include/boost/config/compiler/borland.hpp index 14923c77..d33dd25a 100644 --- a/include/boost/config/compiler/borland.hpp +++ b/include/boost/config/compiler/borland.hpp @@ -25,6 +25,7 @@ # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS # define BOOST_NO_DEDUCED_TYPENAME +# define BOOST_NO_SFINAE #endif // Version 7.0 (Kylix) and below: diff --git a/include/boost/config/compiler/gcc.hpp b/include/boost/config/compiler/gcc.hpp index c4408e64..e9ee0a8c 100644 --- a/include/boost/config/compiler/gcc.hpp +++ b/include/boost/config/compiler/gcc.hpp @@ -29,6 +29,10 @@ # endif # endif +# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 +# define BOOST_NO_SFINAE +# endif + # if __GNUC__ == 2 && __GNUC_MINOR__ <= 97 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # define BOOST_NO_OPERATORS_IN_NAMESPACE diff --git a/include/boost/config/compiler/metrowerks.hpp b/include/boost/config/compiler/metrowerks.hpp index ef597159..f9e9d057 100644 --- a/include/boost/config/compiler/metrowerks.hpp +++ b/include/boost/config/compiler/metrowerks.hpp @@ -32,6 +32,10 @@ # define BOOST_NO_UNREACHABLE_RETURN_DETECTION # endif +# if(__MWERKS__ <= 0x3000) +# define BOOST_NO_SFINAE +# endif + # if(__MWERKS__ <= 0x3003) // 8.x # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS # endif diff --git a/include/boost/config/compiler/visualc.hpp b/include/boost/config/compiler/visualc.hpp index cd96949d..083f3b1f 100644 --- a/include/boost/config/compiler/visualc.hpp +++ b/include/boost/config/compiler/visualc.hpp @@ -53,6 +53,7 @@ # define BOOST_NO_USING_TEMPLATE # define BOOST_NO_SWPRINTF # define BOOST_NO_TEMPLATE_TEMPLATES +# define BOOST_NO_SFINAE # if (_MSC_VER > 1200) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif diff --git a/test/boost_no_sfinae.ipp b/test/boost_no_sfinae.ipp new file mode 100644 index 00000000..835cf843 --- /dev/null +++ b/test/boost_no_sfinae.ipp @@ -0,0 +1,68 @@ +// (C) Copyright Eric Friedman 2003. +// Some modifications by Jeremiah Willcock and Jaakko Järvi. +// Use, modification, and distribution is 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) + +// MACRO: BOOST_NO_SFINAE +// TITLE: SFINAE (substitution failure is not an error) +// DESCRIPTION: SFINAE not supported. + + +namespace boost_no_sfinae { + +namespace f1_a { +template +int f1(T*, float) +{ + return 0; +} +} using f1_a::f1; + +namespace f1_b { +template +int f1(T*, int, typename T::int_* = 0) +{ + return 1; +} +} using f1_b::f1; + +namespace f2_a { +template +int f2(T*, float) +{ + return 2; +} +} using f2_a::f2; + +namespace f2_b { +template +typename T::int_ f2(T*, int) +{ + return 3; +} +} using f2_b::f2; + +struct test_t +{ + typedef int int_; +}; + +struct test2_t {}; + +int test() +{ + test_t* t = 0; + test2_t* t2 = 0; + bool correct = + (f1(t, 0) == 1) && + (f1(t2, 0) == 0) && + (f2(t, 0) == 3) && + (f2(t2, 0) == 2); + return !correct; +} + +} + + + diff --git a/test/config_info.cpp b/test/config_info.cpp index dd4cb22d..b604fb2f 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -909,6 +909,7 @@ void print_boost_macros() PRINT_MACRO(BOOST_NO_OPERATORS_IN_NAMESPACE); PRINT_MACRO(BOOST_NO_POINTER_TO_MEMBER_CONST); PRINT_MACRO(BOOST_NO_PRIVATE_IN_AGGREGATE); + PRINT_MACRO(BOOST_NO_SFINAE); PRINT_MACRO(BOOST_NO_SLIST); PRINT_MACRO(BOOST_NO_STD_ALLOCATOR); PRINT_MACRO(BOOST_NO_STD_DISTANCE);