From e574d2c1348f93182668d3587a7666cb0a20cc49 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Mon, 6 Aug 2018 19:11:20 +0100 Subject: [PATCH 1/5] Add tests for scoped_enums. See https://github.com/boostorg/type_traits/issues/80 and https://svn.boost.org/trac10/ticket/9913. --- test/has_binary_classes0_test.cpp | 5 +++++ test/has_complement_test.cpp | 4 +++- test/has_unary_minus_test.cpp | 3 +++ test/has_unary_plus_test.cpp | 3 +++ test/test.hpp | 6 ++++++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/test/has_binary_classes0_test.cpp b/test/has_binary_classes0_test.cpp index 1c6978b..528ee70 100644 --- a/test/has_binary_classes0_test.cpp +++ b/test/has_binary_classes0_test.cpp @@ -259,4 +259,9 @@ TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< C014, C014 &, ret const & >::value), 1); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< C014, C014 const &, ret const & >::value), 1); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< C014 const, C014, ret const >::value), 1); + +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< scoped_enum, scoped_enum >::value), 0); +#endif + TT_TEST_END diff --git a/test/has_complement_test.cpp b/test/has_complement_test.cpp index 394ecca..12af8c0 100644 --- a/test/has_complement_test.cpp +++ b/test/has_complement_test.cpp @@ -222,7 +222,9 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); - +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_unary_minus_test.cpp b/test/has_unary_minus_test.cpp index 5481a16..1751d8c 100644 --- a/test/has_unary_minus_test.cpp +++ b/test/has_unary_minus_test.cpp @@ -219,6 +219,9 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_unary_plus_test.cpp b/test/has_unary_plus_test.cpp index 416c01a..b629afe 100644 --- a/test/has_unary_plus_test.cpp +++ b/test/has_unary_plus_test.cpp @@ -219,6 +219,9 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/test.hpp b/test/test.hpp index 15fd66a..4d0eb32 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -322,6 +322,12 @@ enum enum2 three_,four_ }; +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + +enum class scoped_enum { one, two, three }; + +#endif + struct VB { virtual ~VB(){}; From 5bd3e1142900c40a11c80f05721d1b4ddd0275a9 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Thu, 9 Aug 2018 19:48:36 +0100 Subject: [PATCH 2/5] Make the unary operator traits use "perfect" detection. Update tests accordingly. --- .../detail/has_postfix_operator.hpp | 55 +++ .../detail/has_prefix_operator.hpp | 72 ++++ include/boost/type_traits/has_dereference.hpp | 344 ++++++++++++++++++ .../boost/type_traits/has_post_decrement.hpp | 21 ++ .../boost/type_traits/has_post_increment.hpp | 21 ++ .../boost/type_traits/has_pre_decrement.hpp | 21 ++ .../boost/type_traits/has_pre_increment.hpp | 22 ++ include/boost/type_traits/is_function.hpp | 1 + test/has_post_decrement_test.cpp | 17 + test/has_post_increment_test.cpp | 17 + test/has_pre_decrement_test.cpp | 17 + test/has_pre_increment_test.cpp | 17 + test/has_unary_minus_test.cpp | 14 + test/has_unary_plus_test.cpp | 14 + 14 files changed, 653 insertions(+) diff --git a/include/boost/type_traits/detail/has_postfix_operator.hpp b/include/boost/type_traits/detail/has_postfix_operator.hpp index ba0358f..1812416 100644 --- a/include/boost/type_traits/detail/has_postfix_operator.hpp +++ b/include/boost/type_traits/detail/has_postfix_operator.hpp @@ -7,6 +7,59 @@ // See http://www.boost.org/libs/type_traits for most recent version including documentation. #include +#include + +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +#include +#include +#include +#include +#include +#include + +namespace boost +{ + + namespace binary_op_detail { + + struct dont_care; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>() BOOST_TT_TRAIT_OP) > > + : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP), Ret>::value> {}; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>()BOOST_TT_TRAIT_OP)> > + : public boost::integral_constant::type>() BOOST_TT_TRAIT_OP)>::value> {}; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() BOOST_TT_TRAIT_OP)> > + : public boost::true_type {}; + + } + + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) {}; + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) {}; + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) {}; + + +} + +#else + #include #include #include @@ -193,3 +246,5 @@ struct BOOST_TT_TRAIT_NAME : public integral_constant +#include + +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_GCC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated" +#endif +#if defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4804) +#endif + +namespace boost +{ + + namespace binary_op_detail { + + struct dont_care; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp)::type>()) > > + : public boost::integral_constant::type>() ), Ret>::value> {}; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp)::type>())> > + : public boost::integral_constant::type>())>::value> {}; + + template > + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) : public boost::false_type {}; + + template + struct BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp)::type>() )> > + : public boost::true_type {}; + + } + + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _ret_imp) {}; + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _void_imp) {}; + template + struct BOOST_TT_TRAIT_NAME : public boost::binary_op_detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME, _dc_imp) {}; + + +} + +#ifdef BOOST_GCC +#pragma GCC diagnostic pop +#endif +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#else + #include #include #include @@ -206,3 +275,6 @@ struct BOOST_TT_TRAIT_NAME : public integral_constant + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + // references: + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + // rvalue refs: + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + template + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + template <> + struct has_dereference : public false_type {}; + + +} +#endif #endif diff --git a/include/boost/type_traits/has_post_decrement.hpp b/include/boost/type_traits/has_post_decrement.hpp index e3f98ff..fc1c430 100644 --- a/include/boost/type_traits/has_post_decrement.hpp +++ b/include/boost/type_traits/has_post_decrement.hpp @@ -41,4 +41,25 @@ #undef BOOST_TT_TRAIT_OP #undef BOOST_TT_FORBIDDEN_IF +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +namespace boost { + + template + struct has_post_decrement : public false_type {}; + template <> + struct has_post_decrement : public false_type {}; + template <> + struct has_post_decrement : public false_type {}; + + template + struct has_post_decrement : public false_type {}; + template <> + struct has_post_decrement : public false_type {}; + template <> + struct has_post_decrement : public false_type {}; + +} + +#endif #endif diff --git a/include/boost/type_traits/has_post_increment.hpp b/include/boost/type_traits/has_post_increment.hpp index 3861a2b..e83afd1 100644 --- a/include/boost/type_traits/has_post_increment.hpp +++ b/include/boost/type_traits/has_post_increment.hpp @@ -41,4 +41,25 @@ #undef BOOST_TT_TRAIT_OP #undef BOOST_TT_FORBIDDEN_IF +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +namespace boost { + + template + struct has_post_increment : public false_type {}; + template <> + struct has_post_increment : public false_type {}; + template <> + struct has_post_increment : public false_type {}; + + template + struct has_post_increment : public false_type {}; + template <> + struct has_post_increment : public false_type {}; + template <> + struct has_post_increment : public false_type {}; + +} + +#endif #endif diff --git a/include/boost/type_traits/has_pre_decrement.hpp b/include/boost/type_traits/has_pre_decrement.hpp index 7ef0783..5ce50e9 100644 --- a/include/boost/type_traits/has_pre_decrement.hpp +++ b/include/boost/type_traits/has_pre_decrement.hpp @@ -41,4 +41,25 @@ #undef BOOST_TT_TRAIT_OP #undef BOOST_TT_FORBIDDEN_IF +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +namespace boost { + + template + struct has_pre_decrement : public false_type {}; + template <> + struct has_pre_decrement : public false_type {}; + template <> + struct has_pre_decrement : public false_type {}; + + template + struct has_pre_decrement : public false_type {}; + template <> + struct has_pre_decrement : public false_type {}; + template <> + struct has_pre_decrement : public false_type {}; + +} + +#endif #endif diff --git a/include/boost/type_traits/has_pre_increment.hpp b/include/boost/type_traits/has_pre_increment.hpp index c4c9734..9361cc8 100644 --- a/include/boost/type_traits/has_pre_increment.hpp +++ b/include/boost/type_traits/has_pre_increment.hpp @@ -41,4 +41,26 @@ #undef BOOST_TT_TRAIT_OP #undef BOOST_TT_FORBIDDEN_IF +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + +namespace boost { + + template + struct has_pre_increment : public false_type {}; + template <> + struct has_pre_increment : public false_type {}; + template <> + struct has_pre_increment : public false_type {}; + + template + struct has_pre_increment : public false_type {}; + template <> + struct has_pre_increment : public false_type {}; + template <> + struct has_pre_increment : public false_type {}; + +} + +#endif + #endif diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index f77c1f0..805cd70 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -96,6 +96,7 @@ template struct is_function : integral_constant struct is_function : public false_type {}; #endif +template struct is_function : public false_type {}; #endif } // namespace boost diff --git a/test/has_post_decrement_test.cpp b/test/has_post_decrement_test.cpp index 36e556d..c0f1445 100644 --- a/test/has_post_decrement_test.cpp +++ b/test/has_post_decrement_test.cpp @@ -219,6 +219,23 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_post_increment_test.cpp b/test/has_post_increment_test.cpp index c15c6d3..28157b7 100644 --- a/test/has_post_increment_test.cpp +++ b/test/has_post_increment_test.cpp @@ -219,6 +219,23 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_pre_decrement_test.cpp b/test/has_pre_decrement_test.cpp index f65961e..77710b6 100644 --- a/test/has_pre_decrement_test.cpp +++ b/test/has_pre_decrement_test.cpp @@ -219,6 +219,23 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_pre_increment_test.cpp b/test/has_pre_increment_test.cpp index 80c56a5..d7eaf14 100644 --- a/test/has_pre_increment_test.cpp +++ b/test/has_pre_increment_test.cpp @@ -219,6 +219,23 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + +#ifndef BOOST_NO_CXX11_SCOPED_ENUMS + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif +#endif } TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) diff --git a/test/has_unary_minus_test.cpp b/test/has_unary_minus_test.cpp index 1751d8c..33863fa 100644 --- a/test/has_unary_minus_test.cpp +++ b/test/has_unary_minus_test.cpp @@ -219,8 +219,22 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + #ifndef BOOST_NO_CXX11_SCOPED_ENUMS BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif #endif } diff --git a/test/has_unary_plus_test.cpp b/test/has_unary_plus_test.cpp index b629afe..0c28250 100644 --- a/test/has_unary_plus_test.cpp +++ b/test/has_unary_plus_test.cpp @@ -219,8 +219,22 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + #ifndef BOOST_NO_CXX11_SCOPED_ENUMS BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif #endif } From a408a29ffc7e53b997a9a6738cc5f88756129730 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 10 Aug 2018 12:52:21 +0100 Subject: [PATCH 3/5] Update has_complement tests. --- test/has_complement_test.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/has_complement_test.cpp b/test/has_complement_test.cpp index 12af8c0..d1b9254 100644 --- a/test/has_complement_test.cpp +++ b/test/has_complement_test.cpp @@ -222,8 +222,22 @@ void specific() { BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int & >::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< int* const &, int const & >::value), 0); +#if defined(BOOST_TT_HAS_ACCURATE_BINARY_OPERATOR_DETECTION) + // There are some things that pass that wouldn't otherwise do so: + auto f = []() {}; + auto f2 = [](double)->int { return 2; }; + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); + #ifndef BOOST_NO_CXX11_SCOPED_ENUMS BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, scoped_enum >::value), 0); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME< scoped_enum, void >::value), 0); +#endif #endif } From 66a146c1cb2cbb6fe9ab9b2fa986cfca2fa79e4c Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Fri, 10 Aug 2018 18:13:02 +0100 Subject: [PATCH 4/5] Disable additional specialization for is_function for msvc-10.0 - it doesn't work and leads to ambiguous overloads. Also change the expected result of some tests for msvc-14.0. --- include/boost/type_traits/is_function.hpp | 3 +++ test/has_unary_plus_test.cpp | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/boost/type_traits/is_function.hpp b/include/boost/type_traits/is_function.hpp index 805cd70..f75dd2e 100644 --- a/include/boost/type_traits/is_function.hpp +++ b/include/boost/type_traits/is_function.hpp @@ -13,6 +13,7 @@ #include #include +#include #if !defined(BOOST_TT_TEST_MS_FUNC_SIGS) # include @@ -96,8 +97,10 @@ template struct is_function : integral_constant struct is_function : public false_type {}; #endif +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1600) template struct is_function : public false_type {}; #endif +#endif } // namespace boost #endif // BOOST_TT_IS_FUNCTION_HPP_INCLUDED diff --git a/test/has_unary_plus_test.cpp b/test/has_unary_plus_test.cpp index 0c28250..e24d833 100644 --- a/test/has_unary_plus_test.cpp +++ b/test/has_unary_plus_test.cpp @@ -223,10 +223,15 @@ void specific() { // There are some things that pass that wouldn't otherwise do so: auto f = []() {}; auto f2 = [](double)->int { return 2; }; - BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); - BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); - BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); - BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 1); +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1900) + bool result = false; +#else + bool result = true; +#endif + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); + BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), result); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::BOOST_TT_TRAIT_NAME::value), 0); From 635388aafd4c95c29e609f96e63bb6b3a6f990f4 Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sat, 11 Aug 2018 08:30:08 +0100 Subject: [PATCH 5/5] Issue80: remove redundant test. --- test/has_binary_classes0_test.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/has_binary_classes0_test.cpp b/test/has_binary_classes0_test.cpp index 528ee70..a77a34b 100644 --- a/test/has_binary_classes0_test.cpp +++ b/test/has_binary_classes0_test.cpp @@ -260,8 +260,4 @@ TT_TEST_BEGIN(BOOST_TT_TRAIT_NAME) BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< C014, C014 const &, ret const & >::value), 1); BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< C014 const, C014, ret const >::value), 1); -#ifndef BOOST_NO_CXX11_SCOPED_ENUMS - BOOST_CHECK_INTEGRAL_CONSTANT((::boost::has_plus< scoped_enum, scoped_enum >::value), 0); -#endif - TT_TEST_END