aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-05-21 11:50:50 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-05-21 11:50:50 +0000
commit8593c7810fba6548679e7c89d8eaccebf4d5ec20 (patch)
tree14c8023dee00c7403c30640399568f9dbdd4e8c5 /lib/Sema/SemaOverload.cpp
parentbeaaccd8e2a8748f77b66e2b330fb9136937e14c (diff)
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
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index ef175315e6..98ee13af85 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -4020,6 +4020,15 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
}
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;