Boost logo

Boost :

From: dariomt_at_[hidden]
Date: 2019-06-17 10:09:06

> >
> > However, in my test I throw and catch exceptions:
> > But the CI jobs have gcc and clang configured to compile without
> exception
> > support!

> I have two questions:
> >
> > 1) Where are exceptions disabled in the CI jobs? I can't find it in
> > the .travis.yml,
> > but I can see e.g. clang being invoked with -fno-exceptions
> It's in the test/Jamfile.v2 file, look for <exception-handling>off.

> > 2) How can I test proper support for std::current_exception() and
> > std::rethrow_exception() if exceptions are disabled for the test?
> You should probably condition your test on BOOST_NO_EXCEPTIONS and make
> the test no-op when exceptions are disabled.

But that defeats the whole purpose of having tests.

I think I should at least use the type std::exception_ptr, and make sure
the functions std::current_exception() and std::rethrow_exception() exist
(even if I cannot test that they actually work as expected at runtime).

I think the following should work, and at least the test tests something
when exceptions are off:

using std::exception_ptr;
auto current = &std::current_exception;
auto rethrow = &std::rethrow_exception;

What do you think?

Boost list run by bdawes at, gregod at, cpdaniel at, john at