Boost logo

Boost :

From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2020-11-13 11:17:01


If you diagnose the test failures (which are present across all
compilers) in
https://www.boost.org/development/tests/develop/developer/outcome.html
which report failures of the form:

```
unknown location(0): fatal error: in "works_outcome": Throw location
unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: struct boost::wrapexcept<class boost::exception_ptr>

libs\outcome\test\tests\core-outcome.cpp(173): last checkpoint

*** 1 failure is detected in the test module "Outcome"
```

The cause is test code such as:

```
    boost::system::error_code ec(5, boost::system::system_category());
    auto e = boost::copy_exception(boost::system::system_error(ec)); //
NOLINT
    outcome<int> m(e);
    BOOST_CHECK_THROW(m.value(), boost::system::system_error);
```

Outcome calls boost::rethrow_exception() to rethrow the exception_ptr.
boost::rethrow_exception() is not rethrowing the
boost::system::system_error held within the boost::exception_ptr. It is
throwing instead boost::wrapexcept<class boost::exception_ptr>. This
causes BOOST_CHECK_THROW() to not correctly trap the type of exception
thrown, and thus the test fails.

boost::wrapexcept<E> inherits from E. It seems to me therefore that
catching a const E& ought to catch throws of boost::wrapexcept<E>, and
therefore this code is correct. I double checked this at
https://wandbox.org/permlink/n9Wjb5cPpfHEFalp, and indeed it works as
expected.

However, obviously enough this is failing, and it was not failing in
Boost 1.74, so this is a regression. I am stumped as to the exact cause.

This affects all platforms, POSIX, Windows, clang, GCC and MSVC.

Niall


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk