#include <iostream>
#include <memory>
using namespace std;
struct S
{
S() { cout << "ctor\n"; }
~S() { cout << "dtor\n"; }
void Foo() { cout << "Foo\n"; }
};
std::unique_ptr<S> gS;
int main() {
gS = std::make_unique<S>();
cout << "main\n";
{
cout << "scope\n";
std::move(gS)->Foo();
cout << "end scope\n";
}
cout << "end main\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IFMKewoJUygpIHsgY291dCA8PCAiY3RvclxuIjsgfQoJflMoKSB7IGNvdXQgPDwgImR0b3JcbiI7IH0KCXZvaWQgRm9vKCkgeyBjb3V0IDw8ICJGb29cbiI7IH0KfTsKCnN0ZDo6dW5pcXVlX3B0cjxTPiBnUzsKCmludCBtYWluKCkgewoJZ1MgPSBzdGQ6Om1ha2VfdW5pcXVlPFM+KCk7Cgljb3V0IDw8ICJtYWluXG4iOwoJewoJCWNvdXQgPDwgInNjb3BlXG4iOwoJCXN0ZDo6bW92ZShnUyktPkZvbygpOwoJCWNvdXQgPDwgImVuZCBzY29wZVxuIjsKCX0KCWNvdXQgPDwgImVuZCBtYWluXG4iOwoJcmV0dXJuIDA7Cn0=