#include <iostream>
struct Foo
{
Foo() : a(10), b(20) {}
~Foo() { std::cout << "In Foo::~Foo()\n"; }
int a;
int b;
};
Foo getFoo()
{
return Foo();
}
void testFoo1()
{
int const& r = getFoo().a;
std::cout << "In testFoo1()\n";
(void)r; // Shut up the compiler
}
int main()
{
testFoo1();
}
ICAgICNpbmNsdWRlIDxpb3N0cmVhbT4KICAgIAogICAgc3RydWN0IEZvbyAKICAgIHsKICAgICAgIEZvbygpIDogYSgxMCksIGIoMjApIHt9CiAgICAgICB+Rm9vKCkgeyBzdGQ6OmNvdXQgPDwgIkluIEZvbzo6fkZvbygpXG4iOyB9CiAgICAgICBpbnQgYTsKICAgICAgIGludCBiOwogICAgfTsKICAgIAogICAgRm9vIGdldEZvbygpCiAgICB7CiAgICAgICByZXR1cm4gRm9vKCk7CiAgICB9CiAgICAKICAgIHZvaWQgdGVzdEZvbzEoKQogICAgewogICAgICAgaW50IGNvbnN0JiByID0gZ2V0Rm9vKCkuYTsKICAgICAgIHN0ZDo6Y291dCA8PCAiSW4gdGVzdEZvbzEoKVxuIjsKICAgICAgICh2b2lkKXI7IC8vIFNodXQgdXAgdGhlIGNvbXBpbGVyCiAgICB9CiAgICAKICAgIGludCBtYWluKCkKICAgIHsKICAgICAgIHRlc3RGb28xKCk7CiAgICB9Cg==