fork download
  1. #include <iostream>
  2.  
  3. struct Foo
  4. {
  5. Foo() { std::cout << "Foo()\n";}
  6. Foo(const Foo&) { std::cout << "Foo(const Foo&)\n";}
  7. //Foo(Foo&&) { std::cout << "Foo(Foo&&)\n";}
  8. Foo& operator=(const Foo&) {
  9. std::cout << "Foo& operator=(const Foo&)\n";
  10. return *this;
  11. }
  12. };
  13. Foo operator+(const Foo&, const Foo&) { return Foo(); }
  14.  
  15. int main()
  16. {
  17. Foo f1, f2, f3;
  18. f1 = f2 + f3;
  19. }
  20.  
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
Foo()
Foo()
Foo()
Foo()
Foo& operator=(const Foo&)