]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/detail/decay.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / detail / decay.cpp
1 // Copyright Louis Dionne 2013-2017
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/detail/decay.hpp>
6
7 #include <type_traits>
8 namespace hana = boost::hana;
9
10
11 template <typename T, typename Decayed>
12 void check() {
13 static_assert(std::is_same<
14 typename hana::detail::decay<T>::type,
15 Decayed
16 >::value, "");
17 }
18
19 int main() {
20 // void is untouched
21 check<void, void>();
22
23 // normal types lose cv-qualifiers
24 check<int, int>();
25 check<int const, int>();
26 check<int const volatile, int>();
27
28 // [cv-qualified] references are stripped
29 check<int&, int>();
30 check<int const&, int>();
31 check<int&&, int>();
32 check<int const&&, int>();
33
34 // pointers are untouched
35 check<int*, int*>();
36 check<int const*, int const*>();
37 check<int volatile*, int volatile*>();
38 check<int const volatile*, int const volatile*>();
39
40 // arrays decay to pointers
41 check<int[], int*>();
42 check<int[10], int*>();
43 check<int const[10], int const*>();
44 check<int volatile[10], int volatile*>();
45 check<int const volatile[10], int const volatile*>();
46
47 // functions decay to function pointers
48 check<void(), void(*)()>();
49 check<void(...), void (*)(...)>();
50 check<void(int), void(*)(int)>();
51 check<void(int, ...), void(*)(int, ...)>();
52 check<void(int, float), void(*)(int, float)>();
53 check<void(int, float, ...), void(*)(int, float, ...)>();
54 }