Fix PR7889 by generalizing some over specialized code. There is no

reason that this should be limited to simple lvalues.

llvm-svn: 111331
This commit is contained in:
Chris Lattner 2010-08-18 00:08:27 +00:00
parent 00d5141aef
commit b1995dffaf
2 changed files with 12 additions and 4 deletions

View File

@ -1938,10 +1938,8 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
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());
// Sore the value through the l-value.
EmitStoreThroughLValue(EmitAnyExpr(E->getRHS()), LV, E->getType());
return LV;
}

View File

@ -18,3 +18,13 @@ void test2() { ++a+=10; }
// PR7892
int test3(const char*);
int test3g = test3(__PRETTY_FUNCTION__);
// PR7889
struct test4A {
int j : 2;
};
int test4() {
test4A a;
(a.j = 2) = 3;
}