shared_ptr_assign_fail.cpp 858 B

1234567891011121314151617181920212223242526272829303132
  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_assign_fail.cpp - a negative test for shared_ptr assignment
  10. //
  11. // Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
  12. //
  13. // Distributed under the Boost Software License, Version 1.0. (See
  14. // 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. bool boost_error(char const *, char const *, char const *, long)
  19. {
  20. return true;
  21. }
  22. int main()
  23. {
  24. boost::shared_ptr<int> p;
  25. p = new int(42); // assignment must fail
  26. return 0;
  27. }