
Niall Douglas wrote:
My secondary use case is that rather than encode the logic for how to type erase/rethrow/convert the failure into an exception throw via a preprocessor macro which is how it's usually done e.g. BOOST_THROW_EXCEPTION(), ...
The macro is only needed to capture __FILE__ and __LINE__. If we get std::source_location, it won't be necessary.
What doomed exception specifications is indirect function calls combined with the side channel exception throws operate through, so your function which guarantees to never throw anything but E happens to call some overriden virtual function which throws a different type, and boom you've just called std::terminate.
No, you don't; the overrider is required to have a matching exception specification. What doomed exception specifications is that they just aren't useful. They solve a problem that doesn't need solving.