Apply patch for [CVE-2012-2677][boost] ordered_malloc() overflow
[external/boost.git] / libs / smart_ptr / test / ip_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/intrusive_ptr.hpp>
13
14 //
15
16 struct W
17 {
18 };
19
20 void intrusive_ptr_add_ref( W* )
21 {
22 }
23
24 void 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
40 int f( boost::intrusive_ptr<X> )
41 {
42     return 1;
43 }
44
45 int f( boost::intrusive_ptr<Y> )
46 {
47     return 2;
48 }
49
50 int main()
51 {
52     BOOST_TEST( 1 == f( boost::intrusive_ptr<Z>() ) );
53     return boost::report_errors();
54 }