]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/is_member_func_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_member_func_test.cpp
CommitLineData
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
20struct tricky_members
21{
22 void noexcept_proc()noexcept
23 {}
24 void const_ref_proc()const &
25 {}
26 void rvalue_proc()&&
27 {}
28};
29
30template <class T>
31void test_tricky(T)
32{
33 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<T>::value, true);
34}
35#endif
36
7c673cae
FG
37TT_TEST_BEGIN(is_member_function_pointer)
38
39BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<f1>::value, false);
40BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<f2>::value, false);
41BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<f3>::value, false);
42BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<void*>::value, false);
43BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf1>::value, true);
44BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf2>::value, true);
45BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf3>::value, true);
46BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf4>::value, true);
47BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<cmf>::value, true);
48BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mp>::value, false);
49BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<void>::value, false);
50BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<test_abc1>::value, false);
51BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<foo0_t>::value, false);
52BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<int&>::value, false);
53BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int&>::value, false);
54BOOST_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
57BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf5>::value, true);
58BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf6>::value, true);
59BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<mf7>::value, true);
60#endif
61BOOST_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:
65BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<const int[] >::value, false);
66#endif
67BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<void>::value, false);
68
69#ifdef BOOST_TT_TEST_MS_FUNC_SIGS
92f5a8d4 70
7c673cae
FG
71typedef void (__stdcall test_abc1::*scall_proc)();
72BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<scall_proc>::value, true);
92f5a8d4 73#ifndef __CLR_VER
7c673cae
FG
74typedef void (__fastcall test_abc1::*fcall_proc)(int);
75BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<fcall_proc>::value, true);
92f5a8d4 76#endif
7c673cae
FG
77typedef void (__cdecl test_abc1::*ccall_proc)(int, long, double);
78BOOST_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))
80typedef void(__vectorcall test_abc1::*vcall_proc)(int, long, double, double, double, double);
81BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_member_function_pointer<vcall_proc>::value, true);
7c673cae 82#endif
92f5a8d4
TL
83typedef void(__thiscall test_abc1::*tcall_proc)(int, long, double, double, double, double);
84BOOST_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
89test_tricky(&tricky_members::const_ref_proc);
90#ifndef BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE
91test_tricky(&tricky_members::noexcept_proc);
92#endif
93test_tricky(&tricky_members::rvalue_proc);
94#endif
7c673cae 95
92f5a8d4 96TT_TEST_END
7c673cae
FG
97
98