1// Copyright 2022 Peter Dimov
2// Distributed under the Boost Software License, Version 1.0.
3// https://www.boost.org/LICENSE_1_0.txt
4
5#include <boost/throw_exception.hpp>
6#include <boost/core/lightweight_test.hpp>
7
8#if defined(_MSC_VER)
9# pragma warning(disable: 4702) // unreachable code
10#endif
11
12class my_exception: public std::exception
13{
14};
15
16int main()
17{
18 try
19 {
20 throw my_exception();
21 }
22 catch( std::exception const & x )
23 {
24 boost::source_location loc = boost::get_throw_location( e: x );
25
26 BOOST_TEST_CSTR_EQ( loc.file_name(), "" );
27 BOOST_TEST_CSTR_EQ( loc.function_name(), "" );
28 BOOST_TEST_EQ( loc.line(), 0u );
29 BOOST_TEST_EQ( loc.column(), 0u );
30 }
31
32 return boost::report_errors();
33}
34

source code of boost/libs/throw_exception/test/throw_with_location_test3.cpp