]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/is_destructible_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_destructible_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 #include "test.hpp"
8 #include "check_integral_constant.hpp"
9 #ifdef TEST_STD
10 # include <type_traits>
11 #else
12 # include <boost/type_traits/is_destructible.hpp>
13 #endif
14
15 #if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
16
17 struct deleted_destruct
18 {
19 deleted_destruct();
20 ~deleted_destruct() = delete;
21 };
22
23 #endif
24
25
26 TT_TEST_BEGIN(is_destructible)
27
28 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool>::value, true);
29 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const>::value, true);
30 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool volatile>::value, true);
31 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const volatile>::value, true);
32
33 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char>::value, true);
34 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const>::value, true);
35 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char volatile>::value, true);
36 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const volatile>::value, true);
37 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char>::value, true);
38 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char>::value, true);
39 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const>::value, true);
40 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const>::value, true);
41 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char volatile>::value, true);
42 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char volatile>::value, true);
43 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const volatile>::value, true);
44 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const volatile>::value, true);
45
46 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short>::value, true);
47 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short>::value, true);
48 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const>::value, true);
49 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const>::value, true);
50 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short volatile>::value, true);
51 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short volatile>::value, true);
52 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const volatile>::value, true);
53 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const volatile>::value, true);
54
55 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int>::value, true);
56 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
57 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const>::value, true);
58 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const>::value, true);
59 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int volatile>::value, true);
60 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int volatile>::value, true);
61 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const volatile>::value, true);
62 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const volatile>::value, true);
63
64 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long>::value, true);
65 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long>::value, true);
66 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const>::value, true);
67 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const>::value, true);
68 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long volatile>::value, true);
69 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long volatile>::value, true);
70 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const volatile>::value, true);
71 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const volatile>::value, true);
72
73 #ifdef BOOST_HAS_LONG_LONG
74
75 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type>::value, true);
76 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type>::value, true);
77 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const>::value, true);
78 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const>::value, true);
79 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type volatile>::value, true);
80 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type volatile>::value, true);
81 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const volatile>::value, true);
82 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const volatile>::value, true);
83
84 #endif
85
86 #ifdef BOOST_HAS_MS_INT64
87
88 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8>::value, true);
89 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8>::value, true);
90 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const>::value, true);
91 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const>::value, true);
92 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 volatile>::value, true);
93 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 volatile>::value, true);
94 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const volatile>::value, true);
95 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const volatile>::value, true);
96
97 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16>::value, true);
98 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16>::value, true);
99 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const>::value, true);
100 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const>::value, true);
101 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 volatile>::value, true);
102 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 volatile>::value, true);
103 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const volatile>::value, true);
104 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const volatile>::value, true);
105
106 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32>::value, true);
107 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32>::value, true);
108 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const>::value, true);
109 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const>::value, true);
110 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 volatile>::value, true);
111 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 volatile>::value, true);
112 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const volatile>::value, true);
113 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const volatile>::value, true);
114
115 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64>::value, true);
116 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64>::value, true);
117 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const>::value, true);
118 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const>::value, true);
119 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 volatile>::value, true);
120 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 volatile>::value, true);
121 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const volatile>::value, true);
122 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const volatile>::value, true);
123
124 #endif
125
126 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float>::value, true);
127 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const>::value, true);
128 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float volatile>::value, true);
129 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const volatile>::value, true);
130
131 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double>::value, true);
132 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const>::value, true);
133 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double volatile>::value, true);
134 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const volatile>::value, true);
135
136 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double>::value, true);
137 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const>::value, true);
138 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double volatile>::value, true);
139 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const volatile>::value, true);
140
141
142 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
143 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void*>::value, true);
144 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int*const>::value, true);
145 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f1>::value, true);
146 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f2>::value, true);
147 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f3>::value, true);
148 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf1>::value, true);
149 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf2>::value, true);
150 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf3>::value, true);
151 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mp>::value, true);
152 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<cmf>::value, true);
153 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT>::value, true);
154 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&>::value, true);
155 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const>::value, true);
156 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile>::value, true);
157 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile>::value, true);
158 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&>::value, true);
159 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&>::value, true);
160 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&>::value, true);
161 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
162 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&&>::value, true);
163 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&&>::value, true);
164 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&&>::value, true);
165 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&&>::value, true);
166 #endif
167
168 //
169 // These are commented out for now because it's not clear what the semantics should be:
170 // on the one hand references always have trivial destructors (in the sense that there is
171 // nothing to destruct), on the other hand the thing referenced may not have a trivial
172 // destructor, it really depends upon the users code as to what should happen here:
173 //
174 //BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int&>::value, false);
175 //BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<const int&>::value, false);
176 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2]>::value, true);
177 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[3][2]>::value, true);
178 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2][4][5][6][3]>::value, true);
179 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<UDT>::value, true);
180 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<empty_UDT>::value, true);
181 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void>::value, false);
182
183 #if !(defined(BOOST_MSVC) && defined(CI_SUPPRESS_KNOWN_ISSUES) && (BOOST_MSVC < 1900))
184 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
185 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<deleted_destruct>::value, false);
186 #endif
187 #endif
188
189 TT_TEST_END
190
191
192