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 "helper2.hpp"
13 #include <boost/throw_exception.hpp>
14 
15 namespace
16 boost
17     {
18     namespace
19     exception_test
20         {
21         inline
22         derives_boost_exception::
derives_boost_exception(int x)23         derives_boost_exception( int x ):
24             x_(x)
25             {
26             }
27 
28         derives_boost_exception::
~derives_boost_exception()29         ~derives_boost_exception() BOOST_NOEXCEPT_OR_NOTHROW
30             {
31             }
32 
33         inline
34         derives_boost_exception_virtually::
derives_boost_exception_virtually(int x)35         derives_boost_exception_virtually( int x ):
36             x_(x)
37             {
38             }
39 
40         derives_boost_exception_virtually::
~derives_boost_exception_virtually()41         ~derives_boost_exception_virtually() BOOST_NOEXCEPT_OR_NOTHROW
42             {
43             }
44 
45         inline
46         derives_std_exception::
derives_std_exception(int x)47         derives_std_exception( int x ):
48             x_(x)
49             {
50             }
51 
52         derives_std_exception::
~derives_std_exception()53         ~derives_std_exception() BOOST_NOEXCEPT_OR_NOTHROW
54             {
55             }
56 
57         template <>
58         void
throw_test_exception(int x)59         throw_test_exception<derives_boost_exception>( int x )
60             {
61             boost::throw_exception( derives_boost_exception(x) );
62             }
63 
64         template <>
65         void
throw_test_exception(int x)66         throw_test_exception<derives_boost_exception_virtually>( int x )
67             {
68             boost::throw_exception( derives_boost_exception_virtually(x) );
69             }
70 
71         template <>
72         void
throw_test_exception(int x)73         throw_test_exception<derives_std_exception>( int x )
74             {
75             boost::throw_exception( derives_std_exception(x) );
76             }
77         }
78     }
79