Avoid using the built-in type checker for assignment in C++ when classes are involved. Patch by Vyacheslav Kononenko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72212 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index ef17531..98ee13a 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4020,6 +4020,15 @@
     }
 
     case OR_No_Viable_Function:
+      // For class as left operand for assignment or compound assigment operator
+      // do not fall through to handling in built-in, but report that no overloaded
+      // assignment operator found
+      if (LHS->getType()->isRecordType() && Opc >= BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign) {
+        Diag(OpLoc,  diag::err_ovl_no_viable_oper)
+             << BinaryOperator::getOpcodeStr(Opc)
+             << LHS->getSourceRange() << RHS->getSourceRange();
+        return ExprError();
+      }
       // No viable function; fall through to handling this as a
       // built-in operator, which will produce an error message for us.
       break;