#include <iostream>
using namespace std;

struct Light
{
  Light() { cout << "Light()"<<endl; }
  Light(const Light&) { cout << "Light(const Light&)"<<endl; }
  ~Light() { cout << "~Light()"<<endl; }
};

struct Heavy
{
  Heavy() { cout << "Heavy()"<<endl; }
  Heavy(const Heavy&) { cout << "Heavy(const Heavy&)"<<endl; }
  //Heavy(const Light&) { cout << "Heavy(const Light&)"<<endl; }
  ~Heavy() { cout << "~Heavy()"<<endl; }

  operator Light() { cout << "operator Light()"<<endl; Light l; return l; }
};

Light ternary(Heavy* h)
{
  cout << "ternary"<<endl;
  return h ? *h : Light();
}


int main()
{
  Heavy h;
  Light l = ternary(&h);

  cout << "return"<<endl;
  return 0;
}
