#include <iostream>
#include <stdlib.h>
struct B{
B(){std::cout<<"B("<<(void*)this<<")"<<std::endl;}
~B(){std::cout<<"B("<<(void*)this<<") del"<<std::endl;}
};
struct A : B{
A(){std::cout<<"A("<<(void*)this<<")"<<std::endl;}
~A(){std::cout<<"A("<<(void*)this<<") del"<<std::endl;}
};
int main(){
A* p = (A*)malloc(sizeof(A));
std::cout<<(void*)p<<std::endl;
new(p) A();
p->~A();
free(p);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RkbGliLmg+CiAKc3RydWN0IEJ7CiAgQigpe3N0ZDo6Y291dDw8IkIoIjw8KHZvaWQqKXRoaXM8PCIpIjw8c3RkOjplbmRsO30KICB+Qigpe3N0ZDo6Y291dDw8IkIoIjw8KHZvaWQqKXRoaXM8PCIpIGRlbCI8PHN0ZDo6ZW5kbDt9Cn07CnN0cnVjdCBBIDogQnsKICBBKCl7c3RkOjpjb3V0PDwiQSgiPDwodm9pZCopdGhpczw8IikiPDxzdGQ6OmVuZGw7fQogIH5BKCl7c3RkOjpjb3V0PDwiQSgiPDwodm9pZCopdGhpczw8IikgZGVsIjw8c3RkOjplbmRsO30KfTsKIAppbnQgbWFpbigpewogICBBKiBwID0gKEEqKW1hbGxvYyhzaXplb2YoQSkpOwogICBzdGQ6OmNvdXQ8PCh2b2lkKilwPDxzdGQ6OmVuZGw7CiAgIG5ldyhwKSBBKCk7CiAgIHAtPn5BKCk7CiAgIGZyZWUocCk7CiAgIHJldHVybiAwOwp9