#include <iostream>
#include <exception>
class A {
public:
virtual ~A() {
std::cout << "~A()" << std::endl;
}
};
class B: public A {
public:
~B() {
std::cout << "~B()" << std::endl;
throw std::exception();
}
};
int main() {
A* a = new B();
delete a;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZXhjZXB0aW9uPgoKY2xhc3MgQSB7CnB1YmxpYzoKCXZpcnR1YWwgfkEoKSB7CgkJc3RkOjpjb3V0IDw8ICJ+QSgpIiA8PCBzdGQ6OmVuZGw7Cgl9Cn07CgpjbGFzcyBCOiBwdWJsaWMgQSB7CnB1YmxpYzoKCX5CKCkgewoJCXN0ZDo6Y291dCA8PCAifkIoKSIgPDwgc3RkOjplbmRsOwoJCXRocm93IHN0ZDo6ZXhjZXB0aW9uKCk7Cgl9Cn07CgkKCQppbnQgbWFpbigpIHsKCUEqIGEgPSBuZXcgQigpOwoJZGVsZXRlIGE7CglyZXR1cm4gMDsKfQo=