It can be called, or it cannot be called. The compiler has the ability to use Return Value Optimization in both cases (although optimization is a bit easier in barthan in foo).
Even if the RVO eliminates the actual calls to the copy constructor, the copy constructor still needs to be defined and available.
source
share