1 // Copyright 2019 Peter Dimov 2 // Distributed under the Boost Software License, Version 1.0. 3 // http://www.boost.org/LICENSE_1_0.txt 4 5 #if defined(_MSC_VER) 6 # pragma warning(disable: 4702) // unreachable code 7 # pragma warning(disable: 4577) // noexcept used without /EHsc 8 #endif 9 10 #include <boost/throw_exception.hpp> 11 #include <cstdlib> 12 #include <cstring> 13 14 class my_exception: public std::exception {}; 15 main()16int main() 17 { 18 BOOST_THROW_EXCEPTION( my_exception() ); 19 return 1; 20 } 21 22 namespace boost 23 { 24 throw_exception(std::exception const &,boost::source_location const & loc)25void throw_exception( std::exception const &, boost::source_location const & loc ) 26 { 27 int r = 0; 28 29 if( std::strcmp( loc.file_name(), __FILE__ ) != 0 ) ++r; 30 if( loc.line() != 18 ) ++r; 31 32 std::exit( r ); 33 } 34 35 } // namespace boost 36