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

source code of boost/libs/smart_ptr/test/ip_convertible_test.cpp