]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/type_traits/test/is_nothrow_move_constructible_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_nothrow_move_constructible_test.cpp
1
2 // (C) Copyright John Maddock 2000.
3 // (C) Copyright Antony Polukhin 2013.
4 // Use, modification and distribution are subject to the
5 // Boost Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #include "test.hpp"
9 #include <boost/config.hpp>
10 #include "check_integral_constant.hpp"
11 #ifdef TEST_STD
12 # include <type_traits>
13 #else
14 # include <boost/type_traits/is_nothrow_move_constructible.hpp>
15 #endif
16
17 struct non_copy
18 {
19 non_copy();
20 private:
21 non_copy(const non_copy&);
22 };
23
24 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
25
26 struct delete_copy
27 {
28 delete_copy();
29 delete_copy(const delete_copy&) = delete;
30 };
31
32 #endif
33
34 #ifndef BOOST_NO_CXX11_NOEXCEPT
35
36 struct noexcept_copy
37 {
38 noexcept_copy();
39 noexcept_copy(const noexcept_copy&)noexcept;
40 };
41
42 struct noexcept_move
43 {
44 noexcept_move();
45 noexcept_move(const noexcept_move&);
46 noexcept_move(noexcept_move&&)noexcept;
47 };
48
49 #endif
50
51 TT_TEST_BEGIN(is_nothrow_move_constructible)
52
53 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool>::value, true);
54 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool const>::value, true);
55 #ifndef TEST_STD
56 // unspecified behaviour:
57 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool volatile>::value, false);
58 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<bool const volatile>::value, false);
59 #endif
60
61 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char>::value, true);
62 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char const>::value, true);
63 #ifndef TEST_STD
64 // unspecified behaviour:
65 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char volatile>::value, false);
66 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<signed char const volatile>::value, false);
67 #endif
68 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char>::value, true);
69 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char>::value, true);
70 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char const>::value, true);
71 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char const>::value, true);
72 #ifndef TEST_STD
73 // unspecified behaviour:
74 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char volatile>::value, false);
75 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char volatile>::value, false);
76 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned char const volatile>::value, false);
77 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<char const volatile>::value, false);
78 #endif
79
80 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short>::value, true);
81 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short>::value, true);
82 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short const>::value, true);
83 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short const>::value, true);
84 #ifndef TEST_STD
85 // unspecified behaviour:
86 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short volatile>::value, false);
87 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short volatile>::value, false);
88 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned short const volatile>::value, false);
89 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<short const volatile>::value, false);
90 #endif
91
92 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int>::value, true);
93 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int>::value, true);
94 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int const>::value, true);
95 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int const>::value, true);
96 #ifndef TEST_STD
97 // unspecified behaviour:
98 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int volatile>::value, false);
99 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int volatile>::value, false);
100 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned int const volatile>::value, false);
101 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int const volatile>::value, false);
102 #endif
103
104 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long>::value, true);
105 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long>::value, true);
106 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long const>::value, true);
107 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long const>::value, true);
108 #ifndef TEST_STD
109 // unspecified behaviour:
110 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long volatile>::value, false);
111 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long volatile>::value, false);
112 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned long const volatile>::value, false);
113 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long const volatile>::value, false);
114 #endif
115
116 #ifdef BOOST_HAS_LONG_LONG
117
118 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type>::value, true);
119 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type>::value, true);
120 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type const>::value, true);
121 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type const>::value, true);
122 #ifndef TEST_STD
123 // unspecified behaviour:
124 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type volatile>::value, false);
125 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type volatile>::value, false);
126 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::ulong_long_type const volatile>::value, false);
127 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible< ::boost::long_long_type const volatile>::value, false);
128 #endif
129 #endif
130
131 #ifdef BOOST_HAS_MS_INT64
132
133 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8>::value, true);
134 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8>::value, true);
135 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 const>::value, true);
136 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 const>::value, true);
137 #ifndef TEST_STD
138 // unspecified behaviour:
139 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 volatile>::value, false);
140 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 volatile>::value, false);
141 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int8 const volatile>::value, false);
142 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int8 const volatile>::value, false);
143 #endif
144
145 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16>::value, true);
146 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16>::value, true);
147 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 const>::value, true);
148 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 const>::value, true);
149 #ifndef TEST_STD
150 // unspecified behaviour:
151 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 volatile>::value, false);
152 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 volatile>::value, false);
153 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int16 const volatile>::value, false);
154 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int16 const volatile>::value, false);
155 #endif
156
157 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32>::value, true);
158 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32>::value, true);
159 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 const>::value, true);
160 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 const>::value, true);
161 #ifndef TEST_STD
162 // unspecified behaviour:
163 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 volatile>::value, false);
164 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 volatile>::value, false);
165 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int32 const volatile>::value, false);
166 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int32 const volatile>::value, false);
167 #endif
168
169 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64>::value, true);
170 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64>::value, true);
171 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 const>::value, true);
172 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 const>::value, true);
173 #ifndef TEST_STD
174 // unspecified behaviour:
175 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 volatile>::value, false);
176 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 volatile>::value, false);
177 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<unsigned __int64 const volatile>::value, false);
178 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<__int64 const volatile>::value, false);
179 #endif
180 #endif
181
182 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float>::value, true);
183 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float const>::value, true);
184 #ifndef TEST_STD
185 // unspecified behaviour:
186 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float volatile>::value, false);
187 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<float const volatile>::value, false);
188 #endif
189
190 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double>::value, true);
191 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double const>::value, true);
192 #ifndef TEST_STD
193 // unspecified behaviour:
194 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double volatile>::value, false);
195 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<double const volatile>::value, false);
196 #endif
197
198 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double>::value, true);
199 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double const>::value, true);
200 #ifndef TEST_STD
201 // unspecified behaviour:
202 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double volatile>::value, false);
203 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<long double const volatile>::value, false);
204 #endif
205
206 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int>::value, true);
207 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<void*>::value, true);
208 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int*const>::value, true);
209 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f1>::value, true);
210 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f2>::value, true);
211 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<f3>::value, true);
212 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf1>::value, true);
213 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf2>::value, true);
214 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mf3>::value, true);
215 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<mp>::value, true);
216 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<cmf>::value, true);
217 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<enum_UDT>::value, true);
218
219 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&>::value, true);
220 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
221 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int&&>::value, true);
222 #endif
223 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<const int&>::value, true);
224 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2]>::value, false);
225 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[3][2]>::value, false);
226 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<int[2][4][5][6][3]>::value, false);
227 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<UDT>::value, false);
228 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<void>::value, false);
229 #if (!defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)) || defined(BOOST_IS_NOTHROW_MOVE_CONSTRUCT)
230 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_UDT>::value, true);
231 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_UDT>::value, true);
232 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_union_UDT>::value, true);
233 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_union_UDT>::value, true);
234 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_copy_UDT>::value, true);
235 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_move_UDT>::value, true);
236 #else
237 // cases we would like to succeed but can't implement in the language:
238 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_UDT>::value, true, false);
239 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_UDT>::value, true, false);
240 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<POD_union_UDT>::value, true, false);
241 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<empty_POD_union_UDT>::value, true, false);
242 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_copy_UDT>::value, true, false);
243 #endif
244 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_assign_UDT>::value, false);
245 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<nothrow_construct_UDT>::value, false);
246 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<test_abc1>::value, false);
247
248 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<non_copy>::value, false);
249
250 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
251 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<delete_copy>::value, false);
252 #endif
253
254 #if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
255 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<noexcept_copy>::value, true);
256 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible<noexcept_move>::value, true);
257 #endif
258
259 TT_TEST_END
260
261
262