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 BOOST_TEST_THROWS( boost::throw_with_location( my_exception() ), my_exception );
19 BOOST_TEST_THROWS( boost::throw_with_location( my_exception() ), std::exception );
20
21 return boost::report_errors();
22}
23

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