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.
Not really. You would still test the facilities when exceptions are enabled. OTOH, I don't see why would anyone care about these components when exceptions are disabled.
If the Jamfile disables exceptions for the library tests, then I think I
need to care. Otherwise this config macro would be untested.
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?
If it works, that would be fine by me. I don't disable exceptions and I don't know whether the standard library components related to exceptions stay available when exceptions are disabled. I wouldn't be surprised if they don't (now or in a future version of the standard library implementation). In any case, as I said, I don't see anyone using these components when exceptions are disabled, so not much point in testing.
In the end I settled for
using std::exception_ptr; using std::current_exception; using std::rethrow_exception; because some old version of clang had issues with auto, sigh... The problem now is that something else is broken in the CI tests, but I'm quite confident that the tests should pass in all of msvc, gcc, clang I'd like to ask for the PR #285 to be merged into develop please ( https://github.com/boostorg/config/pull/285) Thanks!