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 #include <boost/core/no_exceptions_support.hpp> 12 #include <boost/core/quick_exit.hpp> 13 #include <boost/throw_exception.hpp> 14 #include <exception> 15 f()16void f() 17 { 18 boost::throw_exception( std::exception() ); 19 } 20 main()21int main() 22 { 23 BOOST_TRY 24 { 25 f(); 26 } 27 BOOST_CATCH( std::exception const& ) 28 { 29 return 0; 30 } 31 BOOST_CATCH( ... ) 32 { 33 return 1; 34 } 35 BOOST_CATCH_END 36 37 return 1; 38 } 39 40 #if defined(BOOST_NO_EXCEPTIONS) 41 42 namespace boost 43 { 44 throw_exception(std::exception const &)45void throw_exception( std::exception const& ) 46 { 47 boost::quick_exit( 0 ); 48 } 49 50 } 51 52 #endif 53