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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239649 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2015-06-13 00:33:13 +00:00
parent 7726a348df
commit 724b5ab350
2 changed files with 55 additions and 25 deletions

View File

@@ -12,12 +12,13 @@
// member_function_pointer
#include <type_traits>
#include "test_macros.h"
template <class T>
void test_member_function_pointer_imp()
{
static_assert(!std::is_void<T>::value, "");
#if _LIBCPP_STD_VER > 11
#if TEST_STD_VER > 11
static_assert(!std::is_null_pointer<T>::value, "");
#endif
static_assert(!std::is_integral<T>::value, "");
@@ -73,30 +74,63 @@ int main()
test_member_function_pointer<void (Class::*)(int, ...) volatile>();
test_member_function_pointer<void (Class::*)(int, char, ...) volatile>();
#if __cplusplus >= 201103L
// reference qualifiers on functions are a C++11 extension
test_member_function_pointer<void (Class::*)() &&>();
test_member_function_pointer<void (Class::*)(int) &&>();
test_member_function_pointer<void (Class::*)(int, char) &&>();
#if TEST_STD_VER >= 11
test_member_function_pointer<void (Class::*)() &>();
test_member_function_pointer<void (Class::*)(int) &>();
test_member_function_pointer<void (Class::*)(int, char) &>();
test_member_function_pointer<void (Class::*)() volatile &&>();
test_member_function_pointer<void (Class::*)(int) volatile &&>();
test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
test_member_function_pointer<void (Class::*)(...) &&>();
test_member_function_pointer<void (Class::*)(int,...) &&>();
test_member_function_pointer<void (Class::*)(int, char,...) &&>();
test_member_function_pointer<void (Class::*)(...) &>();
test_member_function_pointer<void (Class::*)(int,...) &>();
test_member_function_pointer<void (Class::*)(int, char,...) &>();
test_member_function_pointer<void (Class::*)() const &>();
test_member_function_pointer<void (Class::*)(int) const &>();
test_member_function_pointer<void (Class::*)(int, char) const &>();
test_member_function_pointer<void (Class::*)(...) const &>();
test_member_function_pointer<void (Class::*)(int,...) const &>();
test_member_function_pointer<void (Class::*)(int, char,...) const &>();
test_member_function_pointer<void (Class::*)() volatile &>();
test_member_function_pointer<void (Class::*)(int) volatile &>();
test_member_function_pointer<void (Class::*)(int, char) volatile &>();
test_member_function_pointer<void (Class::*)(...) volatile &>();
test_member_function_pointer<void (Class::*)(int,...) volatile &>();
test_member_function_pointer<void (Class::*)(int, char,...) volatile &>();
test_member_function_pointer<void (Class::*)() const volatile &>();
test_member_function_pointer<void (Class::*)(int) const volatile &>();
test_member_function_pointer<void (Class::*)(int, char) const volatile &>();
test_member_function_pointer<void (Class::*)(...) const volatile &>();
test_member_function_pointer<void (Class::*)(int,...) const volatile &>();
test_member_function_pointer<void (Class::*)(int, char,...) const volatile &>();
// RValue qualifiers
test_member_function_pointer<void (Class::*)() &&>();
test_member_function_pointer<void (Class::*)(int) &&>();
test_member_function_pointer<void (Class::*)(int, char) &&>();
test_member_function_pointer<void (Class::*)(...) &&>();
test_member_function_pointer<void (Class::*)(int,...) &&>();
test_member_function_pointer<void (Class::*)(int, char,...) &&>();
test_member_function_pointer<void (Class::*)() const &&>();
test_member_function_pointer<void (Class::*)(int) const &&>();
test_member_function_pointer<void (Class::*)(int, char) const &&>();
test_member_function_pointer<void (Class::*)(...) const &&>();
test_member_function_pointer<void (Class::*)(int,...) const &&>();
test_member_function_pointer<void (Class::*)(int, char,...) const &&>();
test_member_function_pointer<void (Class::*)() volatile &&>();
test_member_function_pointer<void (Class::*)(int) volatile &&>();
test_member_function_pointer<void (Class::*)(int, char) volatile &&>();
test_member_function_pointer<void (Class::*)(...) volatile &&>();
test_member_function_pointer<void (Class::*)(int,...) volatile &&>();
test_member_function_pointer<void (Class::*)(int, char,...) volatile &&>();
test_member_function_pointer<void (Class::*)() const volatile &&>();
test_member_function_pointer<void (Class::*)(int) const volatile &&>();
test_member_function_pointer<void (Class::*)(int, char) const volatile &&>();
test_member_function_pointer<void (Class::*)(...) const volatile &&>();
test_member_function_pointer<void (Class::*)(int,...) const volatile &&>();
test_member_function_pointer<void (Class::*)(int, char,...) const volatile &&>();
#endif
}