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