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/core/lightweight_test.hpp> 12 #include <boost/intrusive_ptr.hpp> 13 14 // 15 16 struct W 17 { 18 }; 19 intrusive_ptr_add_ref(W *)20void intrusive_ptr_add_ref( W* ) 21 { 22 } 23 intrusive_ptr_release(W *)24void intrusive_ptr_release( W* ) 25 { 26 } 27 28 struct X: public virtual W 29 { 30 }; 31 32 struct Y: public virtual W 33 { 34 }; 35 36 struct Z: public X 37 { 38 }; 39 f(boost::intrusive_ptr<X>)40int f( boost::intrusive_ptr<X> ) 41 { 42 return 1; 43 } 44 f(boost::intrusive_ptr<Y>)45int f( boost::intrusive_ptr<Y> ) 46 { 47 return 2; 48 } 49 main()50int main() 51 { 52 BOOST_TEST( 1 == f( boost::intrusive_ptr<Z>() ) ); 53 return boost::report_errors(); 54 } 55