1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. 2 3 //Distributed under the Boost Software License, Version 1.0. (See accompanying 4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #define BOOST_EXCEPTION_DISABLE 7 #include <boost/throw_exception.hpp> 8 #include <boost/core/lightweight_test.hpp> 9 10 #if defined(_MSC_VER) 11 # pragma warning(disable: 4702) // unreachable code 12 #endif 13 14 class my_exception: public std::exception { }; 15 16 int main()17main() 18 { 19 try 20 { 21 boost::throw_exception(my_exception()); 22 BOOST_ERROR("boost::throw_exception failed to throw."); 23 } 24 catch( 25 my_exception & ) 26 { 27 } 28 catch( 29 ... ) 30 { 31 BOOST_ERROR("boost::throw_exception malfunction."); 32 } 33 return boost::report_errors(); 34 } 35