]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/is_member_func_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_member_func_test.cpp
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
7 #ifdef TEST_STD
8 # include <type_traits>
9 #else
10 # include <boost/type_traits/is_member_function_pointer.hpp>
11 #endif
12 #include "test.hpp"
13 #include "check_integral_constant.hpp"
14
15 #if defined(BOOST_GCC) && (BOOST_GCC >= 70000)
16 #pragma GCC diagnostic ignored "-Wnoexcept-type"
17 #endif
18
19 #ifdef BOOST_TT_HAS_ACCURATE_IS_FUNCTION
20 struct tricky_members
21 {
22 BOOST_TT_PROC void noexcept_proc()noexcept
23 {}
24 BOOST_TT_PROC void const_ref_proc()const &
25 {}
26 BOOST_TT_PROC void rvalue_proc()&&
27 {}
28 };
29
30 template <class T>
31 BOOST_TT_PROC void test_tricky(T)
32 {
33 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<T>::value, true);
34 }
35 #endif
36
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);
55
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);
60 #endif
61 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf8>::value, true);
62
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
70
71 typedef void (__stdcall test_abc1::*scall_proc)();
72 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<scall_proc>::value, true);
73 #ifndef _MANAGED
74 typedef void (__fastcall test_abc1::*fcall_proc)(int);
75 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<fcall_proc>::value, true);
76 #endif
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);
82 #endif
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);
85
86 #endif
87
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);
92 #endif
93 test_tricky(&tricky_members::rvalue_proc);
94 #endif
95
96 TT_TEST_END
97
98