2 // (C) Copyright John Maddock 2000.
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 # include <type_traits>
10 # include <boost/type_traits/is_member_function_pointer.hpp>
13 #include "check_integral_constant.hpp"
15 #if defined(BOOST_GCC) && (BOOST_GCC >= 70000)
16 #pragma GCC diagnostic ignored "-Wnoexcept-type"
19 #ifdef BOOST_TT_HAS_ACCURATE_IS_FUNCTION
22 BOOST_TT_PROC
void noexcept_proc()noexcept
24 BOOST_TT_PROC
void const_ref_proc()const &
26 BOOST_TT_PROC
void rvalue_proc()&&
31 BOOST_TT_PROC
void test_tricky(T
)
33 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<T
>::value
, true);
37 TT_TEST_BEGIN(is_member_function_pointer
)
39 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<f1
>::value
, false);
40 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<f2
>::value
, false);
41 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<f3
>::value
, false);
42 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<void*>::value
, false);
43 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf1
>::value
, true);
44 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf2
>::value
, true);
45 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf3
>::value
, true);
46 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf4
>::value
, true);
47 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<cmf
>::value
, true);
48 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mp
>::value
, false);
49 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<void>::value
, false);
50 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<test_abc1
>::value
, false);
51 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<foo0_t
>::value
, false);
52 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<int&>::value
, false);
53 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<const int&>::value
, false);
54 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<const int[2] >::value
, false);
56 #if defined(__cpp_noexcept_function_type) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE)
57 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf5
>::value
, true);
58 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf6
>::value
, true);
59 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf7
>::value
, true);
61 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<mf8
>::value
, true);
64 // this test may not be strictly legal:
65 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<const int[] >::value
, false);
67 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<void>::value
, false);
69 #ifdef BOOST_TT_TEST_MS_FUNC_SIGS
71 typedef void (__stdcall
test_abc1::*scall_proc
)();
72 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<scall_proc
>::value
, true);
74 typedef void (__fastcall
test_abc1::*fcall_proc
)(int);
75 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<fcall_proc
>::value
, true);
77 typedef void (__cdecl
test_abc1::*ccall_proc
)(int, long, double);
78 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<ccall_proc
>::value
, true);
79 #if (_MSC_VER >= 1800) && !defined(_MANAGED) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64))
80 typedef void(__vectorcall
test_abc1::*vcall_proc
)(int, long, double, double, double, double);
81 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<vcall_proc
>::value
, true);
83 typedef void(__thiscall
test_abc1::*tcall_proc
)(int, long, double, double, double, double);
84 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer
<tcall_proc
>::value
, true);
88 #ifdef BOOST_TT_HAS_ACCURATE_IS_FUNCTION
89 test_tricky(&tricky_members::const_ref_proc
);
90 #ifndef BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE
91 test_tricky(&tricky_members::noexcept_proc
);
93 test_tricky(&tricky_members::rvalue_proc
);