Closed pdimov closed 2 years ago
Same problem exists with exceptions derived from some other standard exception type, such as std::logic_error
: https://godbolt.org/z/e73Moo5MP
It looks like the code starting here: https://github.com/boostorg/exception/blob/b8e9e98b33a18e020e0452497a47ca383e0a616d/include/boost/exception/detail/exception_ptr.hpp#L379
isn't correct; std::current_exception()
should be used first, when available, not as a last resort.
See #43.
See https://godbolt.org/z/dofa6bbcc.
This exception type
can be caught with
current_exception
and rethrown properly byrethrow_exception
:However if we add a
boost::exception
base,rethrow_exception
no longer throwsmy_exception2
:even though it does throw something derived from
boost::exception
: