| 1 | // |
|---|---|
| 2 | // Test for no_exceptions_support.hpp |
| 3 | // |
| 4 | // Copyright 2019 Peter Dimov |
| 5 | // |
| 6 | // Distributed under the Boost Software License, Version 1.0. |
| 7 | // See accompanying file LICENSE_1_0.txt or copy at |
| 8 | // http://www.boost.org/LICENSE_1_0.txt |
| 9 | // |
| 10 | |
| 11 | #if defined(_MSC_VER) |
| 12 | # pragma warning(disable: 4530) // C++ exception handler used |
| 13 | # pragma warning(disable: 4577) // noexcept used without /EHsc |
| 14 | # pragma warning(disable: 4702) // unreachable code |
| 15 | #endif |
| 16 | |
| 17 | #include <boost/core/no_exceptions_support.hpp> |
| 18 | #include <boost/core/quick_exit.hpp> |
| 19 | #include <boost/throw_exception.hpp> |
| 20 | #include <exception> |
| 21 | |
| 22 | void f() |
| 23 | { |
| 24 | boost::throw_exception( e: std::exception() ); |
| 25 | } |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | BOOST_TRY |
| 30 | { |
| 31 | f(); |
| 32 | } |
| 33 | BOOST_CATCH( std::exception const& ) |
| 34 | { |
| 35 | return 0; |
| 36 | } |
| 37 | BOOST_CATCH( ... ) |
| 38 | { |
| 39 | return 1; |
| 40 | } |
| 41 | BOOST_CATCH_END |
| 42 | |
| 43 | return 1; |
| 44 | } |
| 45 | |
| 46 | #if defined(BOOST_NO_EXCEPTIONS) |
| 47 | |
| 48 | namespace boost |
| 49 | { |
| 50 | |
| 51 | void throw_exception( std::exception const& ) |
| 52 | { |
| 53 | boost::quick_exit( 0 ); |
| 54 | } |
| 55 | |
| 56 | } |
| 57 | |
| 58 | #endif |
| 59 |
