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>
11 #if !(defined(BOOST_MSVC) && defined(BOOST_TT_DISABLE_INTRINSICS) && defined(CI_SUPPRESS_KNOWN_ISSUES))
13 #include "check_integral_constant.hpp"
15 # include <type_traits>
17 # include <boost/type_traits/is_nothrow_move_constructible.hpp>
24 non_copy(const non_copy
&);
27 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
32 delete_copy(const delete_copy
&) = delete;
37 #ifndef BOOST_NO_CXX11_NOEXCEPT
42 noexcept_copy(const noexcept_copy
&)noexcept
;
48 noexcept_move(const noexcept_move
&);
49 noexcept_move(noexcept_move
&&)noexcept
;
54 TT_TEST_BEGIN(is_nothrow_move_constructible
)
56 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<bool>::value
, true);
57 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<bool const>::value
, true);
59 // unspecified behaviour:
60 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<bool volatile>::value
, false);
61 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<bool const volatile>::value
, false);
64 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<signed char>::value
, true);
65 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<signed char const>::value
, true);
67 // unspecified behaviour:
68 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<signed char volatile>::value
, false);
69 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<signed char const volatile>::value
, false);
71 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned char>::value
, true);
72 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<char>::value
, true);
73 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned char const>::value
, true);
74 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<char const>::value
, true);
76 // unspecified behaviour:
77 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned char volatile>::value
, false);
78 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<char volatile>::value
, false);
79 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned char const volatile>::value
, false);
80 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<char const volatile>::value
, false);
83 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned short>::value
, true);
84 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<short>::value
, true);
85 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned short const>::value
, true);
86 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<short const>::value
, true);
88 // unspecified behaviour:
89 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned short volatile>::value
, false);
90 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<short volatile>::value
, false);
91 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned short const volatile>::value
, false);
92 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<short const volatile>::value
, false);
95 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned int>::value
, true);
96 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int>::value
, true);
97 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned int const>::value
, true);
98 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int const>::value
, true);
100 // unspecified behaviour:
101 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned int volatile>::value
, false);
102 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int volatile>::value
, false);
103 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned int const volatile>::value
, false);
104 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int const volatile>::value
, false);
107 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned long>::value
, true);
108 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long>::value
, true);
109 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned long const>::value
, true);
110 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long const>::value
, true);
112 // unspecified behaviour:
113 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned long volatile>::value
, false);
114 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long volatile>::value
, false);
115 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned long const volatile>::value
, false);
116 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long const volatile>::value
, false);
119 #ifdef BOOST_HAS_LONG_LONG
121 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::ulong_long_type
>::value
, true);
122 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::long_long_type
>::value
, true);
123 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::ulong_long_type
const>::value
, true);
124 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::long_long_type
const>::value
, true);
126 // unspecified behaviour:
127 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::ulong_long_type
volatile>::value
, false);
128 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::long_long_type
volatile>::value
, false);
129 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::ulong_long_type
const volatile>::value
, false);
130 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
< ::boost::long_long_type
const volatile>::value
, false);
134 #ifdef BOOST_HAS_MS_INT64
136 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int8
>::value
, true);
137 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int8
>::value
, true);
138 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int8
const>::value
, true);
139 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int8
const>::value
, true);
141 // unspecified behaviour:
142 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int8
volatile>::value
, false);
143 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int8
volatile>::value
, false);
144 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int8
const volatile>::value
, false);
145 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int8
const volatile>::value
, false);
148 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int16
>::value
, true);
149 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int16
>::value
, true);
150 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int16
const>::value
, true);
151 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int16
const>::value
, true);
153 // unspecified behaviour:
154 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int16
volatile>::value
, false);
155 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int16
volatile>::value
, false);
156 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int16
const volatile>::value
, false);
157 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int16
const volatile>::value
, false);
160 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int32
>::value
, true);
161 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int32
>::value
, true);
162 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int32
const>::value
, true);
163 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int32
const>::value
, true);
165 // unspecified behaviour:
166 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int32
volatile>::value
, false);
167 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int32
volatile>::value
, false);
168 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int32
const volatile>::value
, false);
169 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int32
const volatile>::value
, false);
172 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int64
>::value
, true);
173 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int64
>::value
, true);
174 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int64
const>::value
, true);
175 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int64
const>::value
, true);
177 // unspecified behaviour:
178 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int64
volatile>::value
, false);
179 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int64
volatile>::value
, false);
180 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<unsigned __int64
const volatile>::value
, false);
181 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<__int64
const volatile>::value
, false);
185 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<float>::value
, true);
186 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<float const>::value
, true);
188 // unspecified behaviour:
189 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<float volatile>::value
, false);
190 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<float const volatile>::value
, false);
193 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<double>::value
, true);
194 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<double const>::value
, true);
196 // unspecified behaviour:
197 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<double volatile>::value
, false);
198 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<double const volatile>::value
, false);
201 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long double>::value
, true);
202 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long double const>::value
, true);
204 // unspecified behaviour:
205 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long double volatile>::value
, false);
206 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<long double const volatile>::value
, false);
209 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int>::value
, true);
210 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<void*>::value
, true);
211 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int*const>::value
, true);
212 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<f1
>::value
, true);
213 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<f2
>::value
, true);
214 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<f3
>::value
, true);
215 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<mf1
>::value
, true);
216 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<mf2
>::value
, true);
217 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<mf3
>::value
, true);
218 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<mp
>::value
, true);
219 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<cmf
>::value
, true);
220 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<enum_UDT
>::value
, true);
222 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int&>::value
, true);
223 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
224 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int&&>::value
, true);
226 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<const int&>::value
, true);
227 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int[2]>::value
, false);
228 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int[3][2]>::value
, false);
229 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<int[2][4][5][6][3]>::value
, false);
230 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<UDT
>::value
, false);
231 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<void>::value
, false);
232 #if (!defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)) || defined(BOOST_IS_NOTHROW_MOVE_CONSTRUCT)
233 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<empty_POD_UDT
>::value
, true);
234 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<POD_UDT
>::value
, true);
235 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<POD_union_UDT
>::value
, true);
236 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<empty_POD_union_UDT
>::value
, true);
237 #if !defined(BOOST_GCC) || (BOOST_GCC >= 40800)
238 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<nothrow_copy_UDT
>::value
, true);
239 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<nothrow_move_UDT
>::value
, true);
242 // cases we would like to succeed but can't implement in the language:
243 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<empty_POD_UDT
>::value
, true, false);
244 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<POD_UDT
>::value
, true, false);
245 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<POD_union_UDT
>::value
, true, false);
246 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<empty_POD_union_UDT
>::value
, true, false);
247 BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<nothrow_copy_UDT
>::value
, true, false);
249 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<nothrow_assign_UDT
>::value
, false);
250 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<nothrow_construct_UDT
>::value
, false);
251 #if !defined(BOOST_GCC) || (BOOST_GCC >= 40700)
252 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<test_abc1
>::value
, false);
255 #if !defined(BOOST_GCC) || (BOOST_GCC >= 40800)
256 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<non_copy
>::value
, false);
259 #ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
260 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<delete_copy
>::value
, false);
263 #if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
264 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<noexcept_copy
>::value
, true);
265 #if !defined(BOOST_GCC) || (BOOST_GCC >= 40800)
266 // Test fails on gcc 4.7.x:
267 BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_nothrow_move_constructible
<noexcept_move
>::value
, true);
275 int main() { return 0; }