bombela / backward-cpp

A beautiful stack trace pretty printer for C++
MIT License
3.73k stars 471 forks source link

Fix compilation error with C++17 compiler #199

Closed hshakula closed 3 years ago

hshakula commented 3 years ago

Fixes #198

My limited testing showed that backward-cpp works fine without the deprecated std::set_unexpected. But I cannot guarantee that it would still work for all cases as I was not researching why std::set_unexpected was used by backward-cpp and why was it removed from c++17.

bombela commented 3 years ago

From https://en.cppreference.com/w/cpp/error/unexpected_handler:

std::unexpected() is called by the C++ runtime when a dynamic exception specification is violated: an exception is thrown from a function whose exception specification forbids exceptions of this type.

Since the dynamic exception specification has been removed from C++11, this was deprecated. It is now removed. Effectively its only valid on C++98. And even then I am not sure anybody really used dynamic exception specification!

If you are curious about it for posterity: https://en.cppreference.com/w/cpp/language/except_spec