Junior — Senior
std::terminate is called when an exception occurs in the destructor
livecode
Task condition
Under what conditions does executing code inside a try block lead to an automatic call to std::terminate?
void test_destructor()
{
struct B {
~B() noexcept(false) {
throw 1;
}
};
try {
B obj;
throw 2; // considered case
} catch (...) {
}
}