ip_convertible_test.cpp 732 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <boost/config.hpp>
  2. // wp_convertible_test.cpp
  3. //
  4. // Copyright (c) 2008 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. #include <boost/detail/lightweight_test.hpp>
  10. #include <boost/intrusive_ptr.hpp>
  11. //
  12. struct W
  13. {
  14. };
  15. void intrusive_ptr_add_ref( W* )
  16. {
  17. }
  18. void intrusive_ptr_release( W* )
  19. {
  20. }
  21. struct X: public virtual W
  22. {
  23. };
  24. struct Y: public virtual W
  25. {
  26. };
  27. struct Z: public X
  28. {
  29. };
  30. int f( boost::intrusive_ptr<X> )
  31. {
  32. return 1;
  33. }
  34. int f( boost::intrusive_ptr<Y> )
  35. {
  36. return 2;
  37. }
  38. int main()
  39. {
  40. BOOST_TEST( 1 == f( boost::intrusive_ptr<Z>() ) );
  41. return boost::report_errors();
  42. }