]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/type_traits/test/is_destructible_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / type_traits / test / is_destructible_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
7#include "test.hpp"
8#include "check_integral_constant.hpp"
9#ifdef TEST_STD
10# include <type_traits>
11#else
12# include <boost/type_traits/is_destructible.hpp>
13#endif
14
15#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)
16
17struct deleted_destruct
18{
19 deleted_destruct();
20 ~deleted_destruct() = delete;
21};
22
23#endif
24
25
26TT_TEST_BEGIN(is_destructible)
27
28BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool>::value, true);
29BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const>::value, true);
30BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool volatile>::value, true);
31BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<bool const volatile>::value, true);
32
33BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char>::value, true);
34BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const>::value, true);
35BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char volatile>::value, true);
36BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<signed char const volatile>::value, true);
37BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char>::value, true);
38BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char>::value, true);
39BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const>::value, true);
40BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const>::value, true);
41BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char volatile>::value, true);
42BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char volatile>::value, true);
43BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned char const volatile>::value, true);
44BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<char const volatile>::value, true);
45
46BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short>::value, true);
47BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short>::value, true);
48BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const>::value, true);
49BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const>::value, true);
50BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short volatile>::value, true);
51BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short volatile>::value, true);
52BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned short const volatile>::value, true);
53BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<short const volatile>::value, true);
54
55BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int>::value, true);
56BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
57BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const>::value, true);
58BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const>::value, true);
59BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int volatile>::value, true);
60BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int volatile>::value, true);
61BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned int const volatile>::value, true);
62BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int const volatile>::value, true);
63
64BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long>::value, true);
65BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long>::value, true);
66BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const>::value, true);
67BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const>::value, true);
68BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long volatile>::value, true);
69BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long volatile>::value, true);
70BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned long const volatile>::value, true);
71BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long const volatile>::value, true);
72
73#ifdef BOOST_HAS_LONG_LONG
74
75BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type>::value, true);
76BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type>::value, true);
77BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const>::value, true);
78BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const>::value, true);
79BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type volatile>::value, true);
80BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type volatile>::value, true);
81BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::ulong_long_type const volatile>::value, true);
82BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible< ::boost::long_long_type const volatile>::value, true);
83
84#endif
85
86#ifdef BOOST_HAS_MS_INT64
87
88BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8>::value, true);
89BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8>::value, true);
90BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const>::value, true);
91BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const>::value, true);
92BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 volatile>::value, true);
93BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 volatile>::value, true);
94BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int8 const volatile>::value, true);
95BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int8 const volatile>::value, true);
96
97BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16>::value, true);
98BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16>::value, true);
99BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const>::value, true);
100BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const>::value, true);
101BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 volatile>::value, true);
102BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 volatile>::value, true);
103BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int16 const volatile>::value, true);
104BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int16 const volatile>::value, true);
105
106BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32>::value, true);
107BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32>::value, true);
108BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const>::value, true);
109BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const>::value, true);
110BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 volatile>::value, true);
111BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 volatile>::value, true);
112BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int32 const volatile>::value, true);
113BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int32 const volatile>::value, true);
114
115BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64>::value, true);
116BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64>::value, true);
117BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const>::value, true);
118BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const>::value, true);
119BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 volatile>::value, true);
120BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 volatile>::value, true);
121BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<unsigned __int64 const volatile>::value, true);
122BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<__int64 const volatile>::value, true);
123
124#endif
125
126BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float>::value, true);
127BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const>::value, true);
128BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float volatile>::value, true);
129BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<float const volatile>::value, true);
130
131BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double>::value, true);
132BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const>::value, true);
133BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double volatile>::value, true);
134BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<double const volatile>::value, true);
135
136BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double>::value, true);
137BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const>::value, true);
138BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double volatile>::value, true);
139BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<long double const volatile>::value, true);
140
141
142BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int>::value, true);
143BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void*>::value, true);
144BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int*const>::value, true);
145BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f1>::value, true);
146BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f2>::value, true);
147BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<f3>::value, true);
148BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf1>::value, true);
149BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf2>::value, true);
150BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mf3>::value, true);
151BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<mp>::value, true);
152BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<cmf>::value, true);
153BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT>::value, true);
154BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&>::value, true);
155BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const>::value, true);
156BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile>::value, true);
157BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile>::value, true);
158BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&>::value, true);
159BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&>::value, true);
160BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&>::value, true);
161#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
162BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT&&>::value, true);
163BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const&&>::value, true);
164BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT const volatile&&>::value, true);
165BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<enum_UDT volatile&&>::value, true);
166#endif
167
168//
169// These are commented out for now because it's not clear what the semantics should be:
170// on the one hand references always have trivial destructors (in the sense that there is
171// nothing to destruct), on the other hand the thing referenced may not have a trivial
172// destructor, it really depends upon the users code as to what should happen here:
173//
174//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int&>::value, false);
175//BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<const int&>::value, false);
176BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2]>::value, true);
177BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[3][2]>::value, true);
178BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<int[2][4][5][6][3]>::value, true);
179BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<UDT>::value, true);
180BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<empty_UDT>::value, true);
181BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<void>::value, false);
182
b32b8144 183#if !(defined(BOOST_MSVC) && defined(CI_SUPPRESS_KNOWN_ISSUES) && (BOOST_MSVC < 1900))
7c673cae
FG
184#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
185BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_destructible<deleted_destruct>::value, false);
186#endif
b32b8144 187#endif
7c673cae
FG
188
189TT_TEST_END
190
191
192