1-throw_exception_test.cpp 732 B

12345678910111213141516171819202122232425262728293031
  1. //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/throw_exception.hpp>
  5. #include <boost/detail/lightweight_test.hpp>
  6. #include <boost/config.hpp>
  7. class my_exception: public std::exception { };
  8. int
  9. main()
  10. {
  11. try
  12. {
  13. boost::throw_exception(my_exception());
  14. BOOST_ERROR("boost::throw_exception failed to throw.");
  15. }
  16. catch(
  17. my_exception & )
  18. {
  19. }
  20. catch(
  21. ... )
  22. {
  23. BOOST_ERROR("boost::throw_exception malfunction.");
  24. }
  25. return boost::report_errors();
  26. }