Open teajay-fr opened 3 years ago
I've investigated a bit further and it seems that the BOOST version doesn't include the the tests for disabled exceptions. Running the tests from this repository showed that when exceptions are disabled every thing is fine.
Further analysis showed that this version of outcome is OK. It's the boost implementation which has a problem.
To reproduce the error just add this following lines the test directory jam file:
[ run tests/experimental-core-result-status.cpp : : : <rtti>off <exception-handling>off <define>BOOST_NO_RTTI <define>BOOST_NO_EXCEPTIONS ]
I think the outcome-status has the same issue.
Boost.Exception fixed this in https://github.com/boostorg/exception/commit/330008445c38aa793a07909d623addfc885464e6, but it had to be reverted for the Boost 1.74 release last week. Now that is released, the fix is live. And Boost 1.75 will have it.
Standalone Outcome has worked fine on exceptions globally disabled for years now, if that helps.
Re: Enabling the noexcept tests in Boost.Outcome, that is a good idea now that is actually possible, and I will rename this issue accordingly. Thanks for the report!
Hello,
trying to use boost::outcome
in 1.75
but I can't compile without exceptions
c++ -DBOOST_ASIO_HEADER_ONLY -DBOOST_ASIO_NO_DEPRECATED -DBOOST_ASIO_NO_IOSTREAM -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_NO_EXCEPTIONS -O2 -g -DNDEBUG -fno-exceptions -std=gnu++17
smi_message.cpp
In file included from /usr/include/boost/exception_ptr.hpp:9,
from /usr/include/boost/outcome/boost_result.hpp:37,
from /usr/include/boost/outcome/result.hpp:34,
from /usr/include/boost/outcome/outcome.hpp:34,
from /utils/smi_client/smi_client.hpp:8,
from /utils/smi_client/smi_message.cpp:14:
/usr/include/boost/exception/detail/exception_ptr.hpp:12:2: error: #error This header requires exception handling to be enabled.
12 | #error This header requires exception handling to be enabled.
Do I miss some -Dflag
to help skipping this #include
?
@apmanol I vaguely remember it had to be reverted for the 1.75 release as well for some reason, but it's definitely working now. @zajo Can you tell us what might be happening here?
Try with the latest release please, let me know.
Try with the latest release please, let me know.
Thank you very much for your prompt answers!
Unfortunately, the project toolchain has 1.75 version
, so it's not possible to change/experiment with something different.
Anyway, I used the single header approach, that works as it should with -fno-exceptions
.
The support for boost::exception_ptr
under -fno-exceptions
is a new thing, though I didn't take a note in which Boost release it was introduced.
Compiling with BOOST_NO_EXCEPTIONS procuces the following output: