From 8aba6a6db4835fbb9f3d789edff3f92b44eb3850 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sat, 13 Jun 2015 00:33:13 +0000 Subject: [PATCH] Refactor is_member_function_pointer to use is_function and not __member_function_traits. Replacing the dependancy on __member_function_traits with is_function allows is_member_function_pointer to work more often. In particular it allows it to work when we don't have variadic templates but the function has an arity > 3. llvm-svn: 239649 --- libcxx/include/type_traits | 16 +++--- .../member_function_pointer.pass.cpp | 60 +++++++++++++++++----- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 4753a61..760047a 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -479,19 +479,15 @@ struct __member_pointer_traits_imp }; -namespace __libcpp_is_member_function_pointer_imp { - template - char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *); - - template - std::__two __test(...); -}; - template struct __libcpp_is_member_function_pointer - : public integral_constant(nullptr)) == 1> {}; + : public false_type {}; + +template +struct __libcpp_is_member_function_pointer<_Ret _Class::*> + : public is_function<_Ret> {}; template struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer - : public __libcpp_is_member_function_pointer::type> {}; + : public __libcpp_is_member_function_pointer::type>::type {}; // is_member_pointer diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp index 67ef3db..6f546ef 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.cat/member_function_pointer.pass.cpp @@ -12,12 +12,13 @@ // member_function_pointer #include +#include "test_macros.h" template void test_member_function_pointer_imp() { static_assert(!std::is_void::value, ""); -#if _LIBCPP_STD_VER > 11 +#if TEST_STD_VER > 11 static_assert(!std::is_null_pointer::value, ""); #endif static_assert(!std::is_integral::value, ""); @@ -73,30 +74,63 @@ int main() test_member_function_pointer(); test_member_function_pointer(); -#if __cplusplus >= 201103L // reference qualifiers on functions are a C++11 extension - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - +#if TEST_STD_VER >= 11 test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + + // RValue qualifiers + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); - test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); test_member_function_pointer(); + + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); + test_member_function_pointer(); #endif } -- 2.7.4