#include <iostream>

struct X
{
  X(int i)
  {
      x = i;
      std::cerr << "X ctor, x = " << x << std::endl;
  }
  int x;
};

void f()
{
  static X ix(0);
  std::cerr << "f(), ix.x = " << ix.x << std::endl;

  ++ix.x;
  if (ix.x > 5)
  {
    static X iy(ix.x);
    static X iz(ix);    // copy constructor
  }
}

int main()
{
  for ( int i = 0; i < 10; ++i) f();
  return 0;
}