]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/assert/test/source_location_test4.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / assert / test / source_location_test4.cpp
1 // Copyright 2022 Peter Dimov
2 // Distributed under the Boost Software License, Version 1.0.
3 // http://www.boost.org/LICENSE_1_0.txt
4
5 #include <boost/assert/source_location.hpp>
6 #include <boost/core/lightweight_test.hpp>
7 #include <boost/config.hpp>
8
9 boost::source_location s_loc = BOOST_CURRENT_LOCATION;
10
11 BOOST_STATIC_CONSTEXPR boost::source_location c_loc = BOOST_CURRENT_LOCATION;
12
13 boost::source_location f( boost::source_location const& loc = BOOST_CURRENT_LOCATION )
14 {
15 return loc;
16 }
17
18 int main()
19 {
20 {
21 BOOST_TEST_CSTR_EQ( s_loc.file_name(), __FILE__ );
22 BOOST_TEST_EQ( s_loc.line(), 9 );
23
24 #if defined(BOOST_GCC) && BOOST_GCC < 90000
25 // '__static_initialization_and_destruction_0'
26 #else
27 BOOST_TEST_CSTR_EQ( s_loc.function_name(), "" );
28 #endif
29 }
30
31 {
32 BOOST_TEST_CSTR_EQ( c_loc.file_name(), __FILE__ );
33 BOOST_TEST_EQ( c_loc.line(), 11 );
34 }
35
36 {
37 boost::source_location loc = f();
38
39 BOOST_TEST_CSTR_EQ( loc.file_name(), __FILE__ );
40 BOOST_TEST( loc.line() == 13 || loc.line() == 37 );
41 }
42
43 return boost::report_errors();
44 }