Hi folks, how to prevent compiler from doing optimization? class Animal { public: Animal() { cout << this << ": default" << endl; } Animal(const Animal& old) { cout << this << ": copy" << endl; } ~Animal() { cout << this << ": ~" << endl; } }; Animal Gate(Animal animal) { cout << "--- Gate ---" << endl; return animal; } int main() { Animal x; // Gate(x); // 1st case, 2 copies occur Animal y = Gate(x); // 2nd case, 3 copies should occur }