Boost.Exception regression in 1.75.0 beta 1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Boost.Exception regression in 1.75.0 beta 1

Boost - Dev mailing list
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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Exception regression in 1.75.0 beta 1

Boost - Dev mailing list
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.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: Boost.Exception regression in 1.75.0 beta 1

Boost - Dev mailing list
In reply to this post by Boost - Dev mailing list
On Nov 13, 2020, at 3:17 AM, Niall Douglas via Boost <[hidden email]> 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.
>
> 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.

I think that this can be fixed post-beta.

— Marshall



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost