]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/sp_array_cv_test.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / smart_ptr / test / sp_array_cv_test.cpp
1 //
2 // sp_array_cv_test.cpp
3 //
4 // Copyright (c) 2012 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/shared_ptr.hpp>
12
13 struct X
14 {
15 };
16
17 class B
18 {
19 };
20
21 class D: public B
22 {
23 };
24
25 #define TEST_CONV( T, U ) \
26 { \
27 boost::shared_ptr< T > p1; \
28 boost::shared_ptr< U > p2( p1 ); \
29 p2 = p1; \
30 boost::shared_ptr< U > p3 = boost::shared_ptr< T >(); \
31 p3 = boost::shared_ptr< T >(); \
32 }
33
34 #define TEST_CV_TRUE( T, U ) \
35 TEST_CONV( T, U ) \
36 TEST_CONV( T, const U ) \
37 TEST_CONV( T, volatile U ) \
38 TEST_CONV( T, const volatile U ) \
39 TEST_CONV( const T, const U ) \
40 TEST_CONV( const T, const volatile U ) \
41 TEST_CONV( volatile T, volatile U ) \
42 TEST_CONV( volatile T, const volatile U ) \
43 TEST_CONV( const volatile T, const volatile U )
44
45 int main()
46 {
47 TEST_CV_TRUE( X, X )
48 TEST_CV_TRUE( X, void )
49 TEST_CV_TRUE( D, B )
50
51 TEST_CV_TRUE( X[], X[] )
52 TEST_CV_TRUE( X[3], X[3] )
53
54 TEST_CV_TRUE( X[3], X[] )
55
56 TEST_CV_TRUE( X[], void )
57 TEST_CV_TRUE( X[3], void )
58
59 return 0;
60 }