#include <iostream>
struct Counter{
Counter():v(++i){ std::cout << "ctor:" << v << std::endl; }
~Counter(){ std::cout << "dtor:" << v << std::endl; }
Counter f() const { return Counter(); }
const int v;
static int i;
};
int Counter::i=0;
int main(void){
Counter c;
c.f().f().f().f().f();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IENvdW50ZXJ7CiAgICBDb3VudGVyKCk6digrK2kpeyBzdGQ6OmNvdXQgPDwgImN0b3I6IiA8PCB2IDw8IHN0ZDo6ZW5kbDsgfQogICAgfkNvdW50ZXIoKXsgc3RkOjpjb3V0IDw8ICJkdG9yOiIgPDwgdiA8PCBzdGQ6OmVuZGw7IH0KICAgIENvdW50ZXIgZigpIGNvbnN0IHsgcmV0dXJuIENvdW50ZXIoKTsgfQogICAgY29uc3QgaW50IHY7CiAgICBzdGF0aWMgaW50IGk7Cn07CmludCBDb3VudGVyOjppPTA7CgppbnQgbWFpbih2b2lkKXsKICAgIENvdW50ZXIgYzsKICAgIGMuZigpLmYoKS5mKCkuZigpLmYoKTsKICAgIHJldHVybiAwOwp9