diff options
Diffstat (limited to 'clang/lib/CodeGen/CGExprComplex.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprComplex.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp index 25824260aa4..5697a8b1bf4 100644 --- a/clang/lib/CodeGen/CGExprComplex.cpp +++ b/clang/lib/CodeGen/CGExprComplex.cpp @@ -540,10 +540,14 @@ EmitCompoundAssign(const CompoundAssignOperator *E, // Load the RHS and LHS operands. // __block variables need to have the rhs evaluated first, plus this should - // improve codegen a little. It is possible for the RHS to be complex or - // scalar. + // improve codegen a little. OpInfo.Ty = E->getComputationResultType(); - OpInfo.RHS = EmitCast(CK_Unknown, E->getRHS(), OpInfo.Ty); + + // The RHS should have been converted to the computation type. + assert(OpInfo.Ty->isAnyComplexType()); + assert(CGF.getContext().hasSameUnqualifiedType(OpInfo.Ty, + E->getRHS()->getType())); + OpInfo.RHS = Visit(E->getRHS()); LValue LHS = CGF.EmitLValue(E->getLHS()); // We know the LHS is a complex lvalue. |