#include <iostream>
#include <memory>
struct Test {
Test(int i) : _i(i) {}
~Test() { std::cout << _i << std::endl; }
int _i;
};
struct A {
std::unique_ptr<Test> x {std::make_unique<Test>(1)};
};
struct B: public A {
std::unique_ptr<Test> x {std::make_unique<Test>(2)};
};
int main(void) {
std::shared_ptr<A> p = std::make_shared<B>();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgoKc3RydWN0IFRlc3QgewoJVGVzdChpbnQgaSkgOiBfaShpKSB7fQogICAgflRlc3QoKSB7IHN0ZDo6Y291dCA8PCBfaSA8PCBzdGQ6OmVuZGw7IH0KICAgIGludCBfaTsKfTsKCnN0cnVjdCBBIHsKICAgIHN0ZDo6dW5pcXVlX3B0cjxUZXN0PiB4IHtzdGQ6Om1ha2VfdW5pcXVlPFRlc3Q+KDEpfTsKfTsKCnN0cnVjdCBCOiBwdWJsaWMgQSB7CiAgICBzdGQ6OnVuaXF1ZV9wdHI8VGVzdD4geCB7c3RkOjptYWtlX3VuaXF1ZTxUZXN0PigyKX07Cn07CgppbnQgbWFpbih2b2lkKSB7CglzdGQ6OnNoYXJlZF9wdHI8QT4gcCA9IHN0ZDo6bWFrZV9zaGFyZWQ8Qj4oKTsKfQo=