Files
throw_exception/test/throw_exception_nx_test2.cpp

37 lines
796 B
C++
Raw Permalink Normal View History

// Copyright 2019 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
2019-12-08 19:33:48 +02:00
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
2021-09-30 20:44:56 +03:00
# pragma warning(disable: 4530) // C++ exception handler used
2019-12-08 19:33:48 +02:00
#endif
#include <boost/throw_exception.hpp>
#include <cstdlib>
#include <cstring>
class my_exception: public std::exception {};
int main()
{
BOOST_THROW_EXCEPTION( my_exception() );
return 1;
}
namespace boost
{
void throw_exception( std::exception const &, boost::source_location const & loc )
{
int r = 0;
if( std::strcmp( loc.file_name(), __FILE__ ) != 0 ) ++r;
2021-09-30 21:16:03 +03:00
if( loc.line() != 19 ) ++r;
std::exit( r );
}
} // namespace boost