fork download
  1. class Matrix {};
  2.  
  3. Matrix operator+(const Matrix &a, Matrix &&b ) {}
  4. Matrix operator+(Matrix &&a, const Matrix &b) {}
  5. Matrix operator+(const Matrix &a, const Matrix &b) {}
  6.  
  7. Matrix operator*(const Matrix &a, Matrix &&b ) {}
  8. Matrix operator*(Matrix &&a, const Matrix &b) {}
  9. Matrix operator*(const Matrix &a, const Matrix &b) {}
  10.  
  11.  
  12. int main()
  13. {
  14. Matrix a,b,c,d;
  15. Matrix x = a*b + c*d;
  16. }
  17.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:15:22: error: ambiguous overload for 'operator+' in 'operator*(((const Matrix&)((const Matrix*)(& a))), ((const Matrix&)((const Matrix*)(& b)))) + operator*(((const Matrix&)((const Matrix*)(& c))), ((const Matrix&)((const Matrix*)(& d))))'
prog.cpp:3:8: note: candidates are: Matrix operator+(const Matrix&, Matrix&&)
prog.cpp:4:8: note:                 Matrix operator+(Matrix&&, const Matrix&)
prog.cpp:5:8: note:                 Matrix operator+(const Matrix&, const Matrix&)
stdout
Standard output is empty