fork download
  1. class X
  2. {
  3. public:
  4. friend X& operator+=(X& x, const X& y);
  5. };
  6.  
  7. X& operator+=(X& x, const X& y) { return x; }
  8.  
  9. int main()
  10. {
  11. X() += X();
  12. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:11:12: error: no match for 'operator+=' in 'X() += X()'
prog.cpp:7:4: note: candidate is: X& operator+=(X&, const X&)
stdout
Standard output is empty