The example uses built-in types but of course what I really care about are user-defined types.
This is a question about evaluation rules... I believe it is well behaved because the rhs argument to operator= must be fully evaluated before the assignment occurs. But does the copy constructor complete before new returns?
int
main(void)
{
int * p1 = new int(3);
// is this legal? (ignore the memory leak)
p1 = new int(*p1); // clone
return 0;
}
