Closed vector-of-bool closed 2 years ago
Thank you. There is another bug, in that I have a static_assert if you attempt to pass an object of a type that derives from std::exception as anything but the first argument to leaf::exception, which also doesn't trigger for the same reason.
FYI the fix for this and catching abstract exception types will ship with the upcoming Boost release.
The exception-aware overload of
exception()
look as follows (borrowing constraint syntax for conciseness):This causes unexpected behavior if the exception object is an lvalue:
Because
is_base_of<std::exception, std::runtime_error&>
isfalse
, the other overload ofexception()
is selected, and a barestd::exception
object will be returned and then thrown, instead of throwing thestd::runtime_error exc
. Theruntime_error
will instead be loaded as an exception value, which can sometimes be handled:The
[1]
handler will not be invoked, but the[2]
will.Removing cvref qualifiers in the check causes
exception
to behave "as expected:"I'm thinking a simple fix is possible, but want to confirm that this is actually an unintended behavior, and whether there might be other code locations that could also be affected.