]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/pfr/test/run/tie_anonymous_const_field.cpp
1 // Copyright (c) 2020-2022 Antony Polukhin
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/core/lightweight_test.hpp>
8 #include <boost/pfr/core.hpp>
12 #include <type_traits>
27 void test_in_anon_ns_const_field() {
30 auto v
= boost::pfr::structure_tie(x
);
31 using v_type
= decltype(v
);
32 using expected_type
= std::tuple
<other_anon
&, const other_anon
&>;
34 // Use runtime check to make sure that Loophole fails to compile structure_tie
35 BOOST_TEST(typeid(expected_type
) == typeid(v_type
));
38 } // anonymous namespace
40 void test_in_non_non_ns_const_field() {
43 auto v
= boost::pfr::structure_tie(x
);
44 using v_type
= decltype(v
);
45 using expected_type
= std::tuple
<other_anon
&, const other_anon
&>;
47 // Use runtime check to make sure that Loophole fails to compile structure_tie
48 BOOST_TEST(typeid(expected_type
) == typeid(v_type
));
51 } // namespace testing
54 testing::test_in_anon_ns_const_field();
55 testing::test_in_non_non_ns_const_field();
57 return boost::report_errors();