#include <iostream>
#include <utility>
class test
{
private:
test() { }
public:
test foo() { return *this; }
static const char *name() { return "test"; }
};
int main()
{
std::cout << decltype(test().foo())::name() << std::endl; // 1
std::cout << decltype(std::declval<test>().foo())::name() << std::endl; // 2
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KCmNsYXNzIHRlc3QKewpwcml2YXRlOgoJdGVzdCgpIHsgfQpwdWJsaWM6Cgl0ZXN0IGZvbygpIHsgcmV0dXJuICp0aGlzOyB9CgoJc3RhdGljIGNvbnN0IGNoYXIgKm5hbWUoKSB7IHJldHVybiAidGVzdCI7IH0KfTsKCmludCBtYWluKCkKewoJc3RkOjpjb3V0IDw8IGRlY2x0eXBlKHRlc3QoKS5mb28oKSk6Om5hbWUoKSA8PCBzdGQ6OmVuZGw7ICAgICAgICAgICAgICAgLy8gMQoJc3RkOjpjb3V0IDw8IGRlY2x0eXBlKHN0ZDo6ZGVjbHZhbDx0ZXN0PigpLmZvbygpKTo6bmFtZSgpIDw8IHN0ZDo6ZW5kbDsgLy8gMgp9Cg==