]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/has_trivial_move_constructor_test.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / type_traits / test / has_trivial_move_constructor_test.cpp
CommitLineData
7c673cae
FG
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
7c673cae
FG
8#ifdef TEST_STD
9# include <type_traits>
10#else
11# include <boost/type_traits/has_trivial_move_constructor.hpp>
12#endif
11fdf7f2
TL
13#include "test.hpp"
14#include "check_integral_constant.hpp"
7c673cae
FG
15
16#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
17
18struct non_copyable_movable
19{
20 int val;
21 non_copyable_movable(int);
22 non_copyable_movable(const non_copyable_movable&) = delete;
23 non_copyable_movable& operator=(const non_copyable_movable&) = delete;
24#if BOOST_WORKAROUND(BOOST_MSVC, <= 1800) || BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40500)
25 non_copyable_movable(non_copyable_movable&& o) : val(o.val){}
26 non_copyable_movable& operator=(non_copyable_movable&& o)
27 {
28 val = std::move(o.val);
29 return *this;
30 }
31#else
32 non_copyable_movable(non_copyable_movable&&) = default;
33 non_copyable_movable& operator=(non_copyable_movable&&) = default;
34#endif
35};
36
37struct copyable_non_moveable
38{
39 int val;
40 copyable_non_moveable(int);
41 copyable_non_moveable(const copyable_non_moveable&) = default;
42 copyable_non_moveable& operator=(const copyable_non_moveable&) = default;
43 copyable_non_moveable(copyable_non_moveable&&) = delete;
44 copyable_non_moveable& operator=(copyable_non_moveable&&) = delete;
45};
46
47#endif
48
49TT_TEST_BEGIN(has_trivial_move_constructor)
50
51BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<bool>::value, true);
52BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<bool const>::value, true);
53#ifndef TEST_STD
54// unspecified behaviour:
55BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<bool volatile>::value, false);
56BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<bool const volatile>::value, false);
57#endif
58
59BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<signed char>::value, true);
60BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<signed char const>::value, true);
61#ifndef TEST_STD
62// unspecified behaviour:
63BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<signed char volatile>::value, false);
64BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<signed char const volatile>::value, false);
65#endif
66BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned char>::value, true);
67BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<char>::value, true);
68BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned char const>::value, true);
69BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<char const>::value, true);
70#ifndef TEST_STD
71// unspecified behaviour:
72BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned char volatile>::value, false);
73BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<char volatile>::value, false);
74BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned char const volatile>::value, false);
75BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<char const volatile>::value, false);
76#endif
77
78BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned short>::value, true);
79BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<short>::value, true);
80BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned short const>::value, true);
81BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<short const>::value, true);
82#ifndef TEST_STD
83// unspecified behaviour:
84BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned short volatile>::value, false);
85BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<short volatile>::value, false);
86BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned short const volatile>::value, false);
87BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<short const volatile>::value, false);
88#endif
89
90BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned int>::value, true);
91BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int>::value, true);
92BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned int const>::value, true);
93BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int const>::value, true);
94#ifndef TEST_STD
95// unspecified behaviour:
96BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned int volatile>::value, false);
97BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int volatile>::value, false);
98BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned int const volatile>::value, false);
99BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int const volatile>::value, false);
100#endif
101
102BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned long>::value, true);
103BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long>::value, true);
104BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned long const>::value, true);
105BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long const>::value, true);
106#ifndef TEST_STD
107// unspecified behaviour:
108BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned long volatile>::value, false);
109BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long volatile>::value, false);
110BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned long const volatile>::value, false);
111BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long const volatile>::value, false);
112#endif
113#ifdef BOOST_HAS_LONG_LONG
114
115BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::ulong_long_type>::value, true);
116BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::long_long_type>::value, true);
117BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::ulong_long_type const>::value, true);
118BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::long_long_type const>::value, true);
119#ifndef TEST_STD
120// unspecified behaviour:
121BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::ulong_long_type volatile>::value, false);
122BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::long_long_type volatile>::value, false);
123BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::ulong_long_type const volatile>::value, false);
124BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor< ::boost::long_long_type const volatile>::value, false);
125#endif
126#endif
127
128#ifdef BOOST_HAS_MS_INT64
129
130BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int8>::value, true);
131BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int8>::value, true);
132BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int8 const>::value, true);
133BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int8 const>::value, true);
134#ifndef TEST_STD
135// unspecified behaviour:
136BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int8 volatile>::value, false);
137BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int8 volatile>::value, false);
138BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int8 const volatile>::value, false);
139BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int8 const volatile>::value, false);
140#endif
141BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int16>::value, true);
142BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int16>::value, true);
143BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int16 const>::value, true);
144BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int16 const>::value, true);
145#ifndef TEST_STD
146// unspecified behaviour:
147BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int16 volatile>::value, false);
148BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int16 volatile>::value, false);
149BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int16 const volatile>::value, false);
150BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int16 const volatile>::value, false);
151#endif
152BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int32>::value, true);
153BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int32>::value, true);
154BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int32 const>::value, true);
155BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int32 const>::value, true);
156#ifndef TEST_STD
157// unspecified behaviour:
158BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int32 volatile>::value, false);
159BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int32 volatile>::value, false);
160BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int32 const volatile>::value, false);
161BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int32 const volatile>::value, false);
162#endif
163BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int64>::value, true);
164BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int64>::value, true);
165BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int64 const>::value, true);
166BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int64 const>::value, true);
167#ifndef TEST_STD
168// unspecified behaviour:
169BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int64 volatile>::value, false);
170BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int64 volatile>::value, false);
171BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<unsigned __int64 const volatile>::value, false);
172BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<__int64 const volatile>::value, false);
173#endif
174#endif
175
176BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<float>::value, true);
177BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<float const>::value, true);
178#ifndef TEST_STD
179// unspecified behaviour:
180BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<float volatile>::value, false);
181BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<float const volatile>::value, false);
182#endif
183
184BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<double>::value, true);
185BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<double const>::value, true);
186#ifndef TEST_STD
187// unspecified behaviour:
188BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<double volatile>::value, false);
189BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<double const volatile>::value, false);
190#endif
191
192BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long double>::value, true);
193BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long double const>::value, true);
194#ifndef TEST_STD
195// unspecified behaviour:
196BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long double volatile>::value, false);
197BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<long double const volatile>::value, false);
198#endif
199
200BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int>::value, true);
201BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<void*>::value, true);
202BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int*const>::value, true);
203BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<f1>::value, true);
204BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<f2>::value, true);
205BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<f3>::value, true);
206BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<mf1>::value, true);
207BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<mf2>::value, true);
208BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<mf3>::value, true);
209BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<mp>::value, true);
210BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<cmf>::value, true);
211BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<enum_UDT>::value, true);
212
213BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&>::value, true);
214#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
215BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int&&>::value, true);
216#endif
217BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<const int&>::value, true);
218BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2]>::value, false);
219BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[3][2]>::value, false);
220BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<int[2][4][5][6][3]>::value, false);
221BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<UDT>::value, false);
222BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<void>::value, false);
223// cases we would like to succeed but can't implement in the language:
224BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<empty_POD_UDT>::value, true, false);
225BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<POD_UDT>::value, true, false);
226BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<POD_union_UDT>::value, true, false);
227BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<empty_POD_union_UDT>::value, true, false);
228
229BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<trivial_except_copy>::value, false);
230BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<trivial_except_destroy>::value, true, false);
231BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<trivial_except_construct>::value, true, false);
232BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<trivial_except_assign>::value, true, false);
233BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<wrap<trivial_except_copy> >::value, false);
234BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<wrap<trivial_except_destroy> >::value, true, false);
235BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<wrap<trivial_except_construct> >::value, true, false);
236BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<wrap<trivial_except_assign> >::value, true, false);
237
238BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<test_abc1>::value, false);
239
240#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
241BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<non_copyable_movable>::value, true, false);
242BOOST_CHECK_INTEGRAL_CONSTANT(::tt::has_trivial_move_constructor<copyable_non_moveable>::value, false);
243#endif
244
245TT_TEST_END
246
247
248
249
250
251
252
253