Example:
A myfunction() { return A(); }
A a = myfunction(); // default ctor only (return value optimization)
a = myfunction(); // default ctor and operator=
Why can't the compiler just write the new object into the existing object? I believe all instances of a class occupy the same amount of (non dynamic) memory, so I don't see why this would be a problem.