]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/wp_convertible_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / smart_ptr / test / wp_convertible_test.cpp
1 #include <boost/config.hpp>
2
3 // wp_convertible_test.cpp
4 //
5 // Copyright (c) 2008 Peter Dimov
6 //
7 // Distributed under the Boost Software License, Version 1.0.
8 // See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt
10
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/weak_ptr.hpp>
13
14 //
15
16 class incomplete;
17
18 struct X
19 {
20 };
21
22 struct Y
23 {
24 };
25
26 struct Z: public X
27 {
28 };
29
30 int f( boost::weak_ptr<void const> )
31 {
32 return 1;
33 }
34
35 int f( boost::weak_ptr<int> )
36 {
37 return 2;
38 }
39
40 int f( boost::weak_ptr<incomplete> )
41 {
42 return 3;
43 }
44
45 int g( boost::weak_ptr<X> )
46 {
47 return 4;
48 }
49
50 int g( boost::weak_ptr<Y> )
51 {
52 return 5;
53 }
54
55 int g( boost::weak_ptr<incomplete> )
56 {
57 return 6;
58 }
59
60 int main()
61 {
62 BOOST_TEST( 1 == f( boost::weak_ptr<double>() ) );
63 BOOST_TEST( 1 == f( boost::shared_ptr<double>() ) );
64 BOOST_TEST( 4 == g( boost::weak_ptr<Z>() ) );
65 BOOST_TEST( 4 == g( boost::shared_ptr<Z>() ) );
66
67 return boost::report_errors();
68 }