]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/is_pod_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_pod_test.cpp
CommitLineData
7c673cae
FG
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
7c673cae
FG
7#ifdef TEST_STD
8# include <type_traits>
9#else
10# include <boost/type_traits/is_pod.hpp>
11#endif
11fdf7f2
TL
12#include "test.hpp"
13#include "check_integral_constant.hpp"
7c673cae
FG
14
15TT_TEST_BEGIN(is_pod)
16
17BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<bool>::value, true);
18BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<bool const>::value, true);
19BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<bool volatile>::value, true);
20BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<bool const volatile>::value, true);
21
22BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<signed char>::value, true);
23BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<signed char const>::value, true);
24BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<signed char volatile>::value, true);
25BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<signed char const volatile>::value, true);
26BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned char>::value, true);
27BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char>::value, true);
28BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned char const>::value, true);
29BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char const>::value, true);
30BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned char volatile>::value, true);
31BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char volatile>::value, true);
32BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned char const volatile>::value, true);
33BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char const volatile>::value, true);
34
35BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned short>::value, true);
36BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<short>::value, true);
37BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned short const>::value, true);
38BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<short const>::value, true);
39BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned short volatile>::value, true);
40BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<short volatile>::value, true);
41BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned short const volatile>::value, true);
42BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<short const volatile>::value, true);
43
44BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned int>::value, true);
45BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int>::value, true);
46BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned int const>::value, true);
47BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int const>::value, true);
48BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned int volatile>::value, true);
49BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int volatile>::value, true);
50BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned int const volatile>::value, true);
51BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int const volatile>::value, true);
52
53BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned long>::value, true);
54BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long>::value, true);
55BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned long const>::value, true);
56BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long const>::value, true);
57BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned long volatile>::value, true);
58BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long volatile>::value, true);
59BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned long const volatile>::value, true);
60BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long const volatile>::value, true);
61
62#ifdef BOOST_HAS_LONG_LONG
63
64BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::ulong_long_type>::value, true);
65BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::long_long_type>::value, true);
66BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::ulong_long_type const>::value, true);
67BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::long_long_type const>::value, true);
68BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::ulong_long_type volatile>::value, true);
69BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::long_long_type volatile>::value, true);
70BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::ulong_long_type const volatile>::value, true);
71BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod< ::boost::long_long_type const volatile>::value, true);
72
73#endif
74
75#ifdef BOOST_HAS_MS_INT64
76
77BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int8>::value, true);
78BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int8>::value, true);
79BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int8 const>::value, true);
80BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int8 const>::value, true);
81BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int8 volatile>::value, true);
82BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int8 volatile>::value, true);
83BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int8 const volatile>::value, true);
84BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int8 const volatile>::value, true);
85
86BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int16>::value, true);
87BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int16>::value, true);
88BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int16 const>::value, true);
89BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int16 const>::value, true);
90BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int16 volatile>::value, true);
91BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int16 volatile>::value, true);
92BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int16 const volatile>::value, true);
93BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int16 const volatile>::value, true);
94
95BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int32>::value, true);
96BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int32>::value, true);
97BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int32 const>::value, true);
98BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int32 const>::value, true);
99BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int32 volatile>::value, true);
100BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int32 volatile>::value, true);
101BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int32 const volatile>::value, true);
102BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int32 const volatile>::value, true);
103
104BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int64>::value, true);
105BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int64>::value, true);
106BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int64 const>::value, true);
107BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int64 const>::value, true);
108BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int64 volatile>::value, true);
109BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int64 volatile>::value, true);
110BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<unsigned __int64 const volatile>::value, true);
111BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<__int64 const volatile>::value, true);
112
113#endif
114
115BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<float>::value, true);
116BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<float const>::value, true);
117BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<float volatile>::value, true);
118BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<float const volatile>::value, true);
119
120BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<double>::value, true);
121BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<double const>::value, true);
122BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<double volatile>::value, true);
123BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<double const volatile>::value, true);
124
125BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long double>::value, true);
126BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long double const>::value, true);
127BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long double volatile>::value, true);
128BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<long double const volatile>::value, true);
129
130
131BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int>::value, true);
132BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<void*>::value, true);
133BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int*const>::value, true);
134BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<f1>::value, true);
135BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<f2>::value, true);
136BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<f3>::value, true);
137BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<mf1>::value, true);
138BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<mf2>::value, true);
139BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<mf3>::value, true);
140BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<mp>::value, true);
141BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<cmf>::value, true);
142BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<enum_UDT>::value, true);
143
144BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int&>::value, false);
145#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
146BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int&&>::value, false);
147#endif
148BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<const int&>::value, false);
149BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int[2]>::value, true);
150BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int[3][2]>::value, true);
151BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<int[2][4][5][6][3]>::value, true);
152BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<UDT>::value, false);
153BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<empty_UDT>::value, false);
154BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<void>::value, true);
155
156BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<test_abc1>::value, false);
157
158// cases we would like to succeed but can't implement in the language:
159BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_pod<empty_POD_UDT>::value, true, false);
160BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_pod<POD_UDT>::value, true, false);
161BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_pod<POD_union_UDT>::value, true, false);
162BOOST_CHECK_SOFT_INTEGRAL_CONSTANT(::tt::is_pod<empty_POD_union_UDT>::value, true, false);
163
164BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<trivial_except_copy>::value, false);
165BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<trivial_except_destroy>::value, false);
166BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<trivial_except_assign>::value, false);
167BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<trivial_except_construct>::value, false);
168BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<wrap<trivial_except_copy> >::value, false);
169BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<wrap<trivial_except_assign> >::value, false);
170BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<wrap<trivial_except_destroy> >::value, false);
171BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<wrap<trivial_except_construct> >::value, false);
172
173#ifndef BOOST_NO_CXX11_CHAR16_T
174BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char16_t>::value, true);
175#endif
176#ifndef BOOST_NO_CXX11_CHAR32_T
177BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<char32_t>::value, true);
178#endif
179
1e59de90 180#if defined(BOOST_HAS_INT128) && !defined(TEST_CUDA_DEVICE)
7c673cae
FG
181BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<boost::int128_type>::value, true);
182BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<boost::uint128_type>::value, true);
183#endif
184
185#ifdef BOOST_HAS_FLOAT128
186BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_pod<boost::float128_type>::value, true);
187#endif
188
189TT_TEST_END
190
191
192
193
194
195
196
197