I am working on a project that uses a legacy library which uses function definitions like
void func() throw(some_exception);
Since dynamic exception specifications are removed in C++17 I am wondering how to address this problem.
P0003R0 suggests to replace
void func() throw(some_exception) { /* body */ }with something like
void func() { try { /* body */ } catch(const some_exception&) { throw; } }However, I do not have access to the source code (only the header files).
So I am left with trying to "fix" the function definition in the header. So e.g. I could write
void func() noexcept(false);But when the function throws an exception, my application still terminates.
How can I change the function definition in the header files or possibly adjust my own project (the places where i use func) to obtain the same behaviour as throw(some_exception) had before C++17?