зеркало из https://github.com/microsoft/clang-1.git
Handle emitting the assignment operator when the lhs is a reference. Fixes PR5227.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84518 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
da921fd19f
Коммит
86aa0cdfd5
|
@ -1367,6 +1367,16 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
|
|||
if (E->getOpcode() != BinaryOperator::Assign)
|
||||
return EmitUnsupportedLValue(E, "binary l-value expression");
|
||||
|
||||
if (!hasAggregateLLVMType(E->getType())) {
|
||||
// Emit the LHS as an l-value.
|
||||
LValue LV = EmitLValue(E->getLHS());
|
||||
|
||||
llvm::Value *RHS = EmitScalarExpr(E->getRHS());
|
||||
EmitStoreOfScalar(RHS, LV.getAddress(), LV.isVolatileQualified(),
|
||||
E->getType());
|
||||
return LV;
|
||||
}
|
||||
|
||||
llvm::Value *Temp = CreateTempAlloca(ConvertType(E->getType()));
|
||||
EmitAggExpr(E, Temp, false);
|
||||
// FIXME: Are these qualifiers correct?
|
||||
|
|
|
@ -130,3 +130,9 @@ namespace T {
|
|||
}
|
||||
}
|
||||
|
||||
// PR5227.
|
||||
namespace PR5227 {
|
||||
void f(int &a) {
|
||||
(a = 10) = 20;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче