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#include <boost/config.hpp>
7
8#if defined( BOOST_NO_EXCEPTIONS )
9# error This program requires exception handling.
10#endif
11
12#include <boost/throw_exception.hpp>
13#include <boost/detail/lightweight_test.hpp>
14
15class my_exception: public std::exception { };
16
17int
18main()
19 {
20 try
21 {
22 boost::throw_exception(e: my_exception());
23 BOOST_ERROR("boost::throw_exception failed to throw.");
24 }
25 catch(
26 my_exception & )
27 {
28 }
29 catch(
30 ... )
31 {
32 BOOST_ERROR("boost::throw_exception malfunction.");
33 }
34 return boost::report_errors();
35 }
36

source code of boost/libs/exception/test/1-throw_exception_test.cpp