I have a code snippet where I call rethrow_exception with nullptr as argument. The documentation says the argument should be non-null, but I want to know, if I pass nullptr, is the behavior undefined or known?
I am getting bad_exception everytime. However, this link says the behavior is undefined.
std::string msg;
try
{
std::rethrow_exception(nullptr);
}
catch (std::bad_exception &ex)
{
msg = ex.what();
}
catch (std::exception &ex)
{
msg = ex.what();
}
catch (...)
{
msg = "uncaught exception!";
}
Anyone, who can comment upon what exactly happens?