Failure to optimize away the parent pointer

Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=2672

Reported by Martin Stjernholm mast@roxen.com

In the following case, the parent pointer in X ought to be optimized away, but it isn't:

class I {}
    class X
    {
      I i;
    }
int main()
{
  X x = ((program) X)(); // Error: Parent lost, cannot clone program.
}