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)
9 #include <boost/config.hpp>
10 #include "check_integral_constant.hpp"
12 # include <type_traits>
14 # include <boost/type_traits/is_nothrow_move_constructible.hpp>
21 non_copy(const non_copy
&);
24 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
29 delete_copy(const delete_copy
&) = delete;
34 #ifndef BOOST_NO_CXX11_NOEXCEPT
39 noexcept_copy(const noexcept_copy
&)noexcept
;
45 noexcept_move(const noexcept_move
&);
46 noexcept_move(noexcept_move
&&)noexcept
;
51 TT_TEST_BEGIN(is_nothrow_move_constructible
)
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
116 #ifdef BOOST_HAS_LONG_LONG
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);
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);
131 #ifdef BOOST_HAS_MS_INT64
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
248 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<non_copy
>::value
, false);
250 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
251 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<delete_copy
>::value
, false);
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);