]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/atomic_sp_constexpr_test.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / smart_ptr / test / atomic_sp_constexpr_test.cpp
1 //
2 // atomic_sp_constexpr_test.cpp
3 //
4 // Copyright 2017 Peter Dimov
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
9 //
10
11 #include <boost/config.hpp>
12 #include <boost/detail/workaround.hpp>
13
14 #define HAVE_CONSTEXPR_INIT
15
16 #if defined( BOOST_NO_CXX11_CONSTEXPR )
17 # undef HAVE_CONSTEXPR_INIT
18 #endif
19
20 #if BOOST_WORKAROUND( BOOST_MSVC, < 1920 )
21 # undef HAVE_CONSTEXPR_INIT
22 #endif
23
24 #if defined(__clang__) && defined( BOOST_NO_CXX14_CONSTEXPR )
25 # undef HAVE_CONSTEXPR_INIT
26 #endif
27
28 #if defined( _LIBCPP_VERSION ) && ( _LIBCPP_VERSION < 5000 )
29 // in libc++, atomic_flag has a non-constexpr constructor from bool
30 # undef HAVE_CONSTEXPR_INIT
31 #endif
32
33 #if !defined( HAVE_CONSTEXPR_INIT ) || defined( BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX )
34
35 int main()
36 {
37 }
38
39 #else
40
41 #include <boost/smart_ptr/atomic_shared_ptr.hpp>
42 #include <boost/core/lightweight_test.hpp>
43
44 struct X
45 {
46 };
47
48 struct Z
49 {
50 Z();
51 };
52
53 static Z z;
54
55 static boost::atomic_shared_ptr<X> p1;
56
57 Z::Z()
58 {
59 p1 = boost::shared_ptr<X>( new X );
60 }
61
62 int main()
63 {
64 boost::shared_ptr<X> p2 = p1;
65
66 BOOST_TEST( p2.get() != 0 );
67 BOOST_TEST_EQ( p2.use_count(), 2 );
68
69 return boost::report_errors();
70 }
71
72 #endif // #if defined( BOOST_NO_CXX11_CONSEXPR )