shared_ptr_pv_fail.cpp 755 B

12345678910111213141516171819202122232425262728293031
  1. #include <boost/config.hpp>
  2. #if defined(BOOST_MSVC)
  3. #pragma warning(disable: 4786) // identifier truncated in debug info
  4. #pragma warning(disable: 4710) // function not inlined
  5. #pragma warning(disable: 4711) // function selected for automatic inline expansion
  6. #pragma warning(disable: 4514) // unreferenced inline removed
  7. #endif
  8. //
  9. // shared_ptr_pv_fail.cpp - a negative test for converting a shared_ptr to void*
  10. //
  11. // Copyright 2007 Peter Dimov
  12. //
  13. // Distributed under the Boost Software License, Version 1.0.
  14. // See accompanying file LICENSE_1_0.txt or copy at
  15. // http://www.boost.org/LICENSE_1_0.txt
  16. //
  17. #include <boost/shared_ptr.hpp>
  18. void f( void* )
  19. {
  20. }
  21. int main()
  22. {
  23. boost::shared_ptr<int> p;
  24. f( p ); // must fail
  25. return 0;
  26. }