]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | |
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) | |
6 | ||
7c673cae FG |
7 | #ifdef TEST_STD |
8 | # include <type_traits> | |
9 | #else | |
10 | # include <boost/type_traits/is_member_function_pointer.hpp> | |
11 | #endif | |
11fdf7f2 TL |
12 | #include "test.hpp" |
13 | #include "check_integral_constant.hpp" | |
7c673cae | 14 | |
92f5a8d4 TL |
15 | #if defined(BOOST_GCC) && (BOOST_GCC >= 70000) |
16 | #pragma GCC diagnostic ignored "-Wnoexcept-type" | |
17 | #endif | |
18 | ||
19 | #ifdef BOOST_TT_HAS_ASCCURATE_IS_FUNCTION | |
20 | struct tricky_members | |
21 | { | |
22 | void noexcept_proc()noexcept | |
23 | {} | |
24 | void const_ref_proc()const & | |
25 | {} | |
26 | void rvalue_proc()&& | |
27 | {} | |
28 | }; | |
29 | ||
30 | template <class T> | |
31 | void test_tricky(T) | |
32 | { | |
33 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<T>::value, true); | |
34 | } | |
35 | #endif | |
36 | ||
7c673cae FG |
37 | TT_TEST_BEGIN(is_member_function_pointer) |
38 | ||
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); | |
11fdf7f2 | 55 | |
92f5a8d4 | 56 | #if defined(__cpp_noexcept_function_type) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE) |
11fdf7f2 TL |
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); | |
60 | #endif | |
61 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf8>::value, true); | |
62 | ||
7c673cae FG |
63 | #ifndef __IBMCPP__ |
64 | // this test may not be strictly legal: | |
65 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int[] >::value, false); | |
66 | #endif | |
67 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<void>::value, false); | |
68 | ||
69 | #ifdef BOOST_TT_TEST_MS_FUNC_SIGS | |
92f5a8d4 | 70 | |
7c673cae FG |
71 | typedef void (__stdcall test_abc1::*scall_proc)(); |
72 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<scall_proc>::value, true); | |
92f5a8d4 | 73 | #ifndef __CLR_VER |
7c673cae FG |
74 | typedef void (__fastcall test_abc1::*fcall_proc)(int); |
75 | BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<fcall_proc>::value, true); | |
92f5a8d4 | 76 | #endif |
7c673cae FG |
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); | |
92f5a8d4 TL |
79 | #if (_MSC_VER >= 1800) && !defined(__CLR_VER) && (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); | |
7c673cae | 82 | #endif |
92f5a8d4 TL |
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); | |
7c673cae | 85 | |
92f5a8d4 | 86 | #endif |
7c673cae | 87 | |
92f5a8d4 TL |
88 | #ifdef BOOST_TT_HAS_ASCCURATE_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); | |
92 | #endif | |
93 | test_tricky(&tricky_members::rvalue_proc); | |
94 | #endif | |
7c673cae | 95 | |
92f5a8d4 | 96 | TT_TEST_END |
7c673cae FG |
97 | |
98 |