]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_quote_trait.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / mp11 / test / mp_quote_trait.cpp
1
2 // Copyright 2015, 2017 Peter Dimov.
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 //
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8
9
10 #include <boost/mp11/utility.hpp>
11 #include <boost/core/lightweight_test_trait.hpp>
12 #include <type_traits>
13
14 int main()
15 {
16 using boost::mp11::mp_identity;
17 using boost::mp11::mp_quote_trait;
18 using boost::mp11::mp_invoke;
19
20 {
21 using Q = mp_quote_trait<mp_identity>;
22
23 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<void>, void>));
24 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<int[]>, int[]>));
25
26 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void>, void>));
27 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, int[]>, int[]>));
28 }
29
30 {
31 using Q = mp_quote_trait<std::add_pointer>;
32
33 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<void>, void*>));
34 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<int[]>, int(*)[]>));
35
36 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void>, void*>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, int[]>, int(*)[]>));
38 }
39
40 {
41 using Q = mp_quote_trait<std::add_const>;
42
43 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<void>, void const>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same<Q::fn<int[]>, int const[]>));
45
46 #if !BOOST_WORKAROUND( BOOST_GCC, < 40900 )
47
48 // g++ 4.7, 4.8 have difficulties with preserving top-level const
49
50 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, void>, void const>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_invoke<Q, int[]>, int const[]>));
52
53 #endif
54 }
55
56 return boost::report_errors();
57 }