|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2020-11-13 13:46:30
Niall Douglas wrote:
> 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.
The same example without use of outcome works:
#include <boost/exception_ptr.hpp>
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/core/lightweight_test.hpp>
int main()
{
boost::system::error_code ec(5, boost::system::system_category());
auto e = boost::copy_exception(boost::system::system_error(ec));
BOOST_TEST_THROWS(boost::rethrow_exception(e),
boost::system::system_error);
return boost::report_errors();
}
so there's some interaction with outcome here.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk