#include <iostream>
struct A
{
A() { std::cout << this << ":\tA::A()\n"; }
~A() { std::cout << this << ":\tA::~A()\n"; }
};
struct C
{
C() { std::cout << this << ":\tC::C()\n"; }
C(const C&) { std::cout << this << ":\tC::C(const C&)\n"; }
~C() { std::cout << this << ":\tC::~C()\n"; }
};
struct B
{
public:
operator A() const { return A(); }
operator C() const { return C(); }
};
void f(A q) { std::cout << "In f, q's address is " << &q << '\n'; }
void g(C q) { std::cout << "In g, q's address is " << &q << '\n'; }
int main()
{
B d1;
f(d1);
g(d1);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IEEKewogICAgQSgpIHsgc3RkOjpjb3V0IDw8IHRoaXMgPDwgIjpcdEE6OkEoKVxuIjsgfQogICAgfkEoKSB7IHN0ZDo6Y291dCA8PCB0aGlzIDw8ICI6XHRBOjp+QSgpXG4iOyB9Cn07CgpzdHJ1Y3QgQwp7CiAgICBDKCkgeyBzdGQ6OmNvdXQgPDwgdGhpcyA8PCAiOlx0Qzo6QygpXG4iOyB9CiAgICBDKGNvbnN0IEMmKSB7IHN0ZDo6Y291dCA8PCB0aGlzIDw8ICI6XHRDOjpDKGNvbnN0IEMmKVxuIjsgfQogICAgfkMoKSB7IHN0ZDo6Y291dCA8PCB0aGlzIDw8ICI6XHRDOjp+QygpXG4iOyB9Cn07CgpzdHJ1Y3QgQgp7CnB1YmxpYzoKICAgIG9wZXJhdG9yIEEoKSBjb25zdCB7IHJldHVybiBBKCk7IH0KICAgIG9wZXJhdG9yIEMoKSBjb25zdCB7IHJldHVybiBDKCk7IH0KfTsKCnZvaWQgZihBIHEpIHsgc3RkOjpjb3V0IDw8ICJJbiBmLCBxJ3MgYWRkcmVzcyBpcyAiIDw8ICZxIDw8ICdcbic7IH0Kdm9pZCBnKEMgcSkgeyBzdGQ6OmNvdXQgPDwgIkluIGcsIHEncyBhZGRyZXNzIGlzICIgPDwgJnEgPDwgJ1xuJzsgfQoKaW50IG1haW4oKQp7CiAgICBCIGQxOwogICAgZihkMSk7CiAgICBnKGQxKTsKfQ==