forked from OSchip/llvm-project
Create a temporary if the lvalue is a bitfield. Reported by Eli.
llvm-svn: 72155
This commit is contained in:
parent
61da18645b
commit
ad007d44b6
|
@ -182,6 +182,10 @@ public:
|
|||
/// declaration of that bit-field.
|
||||
FieldDecl *getBitField();
|
||||
|
||||
const FieldDecl *getBitField() const {
|
||||
return const_cast<Expr*>(this)->getBitField();
|
||||
}
|
||||
|
||||
/// isIntegerConstantExpr - Return true if this expression is a valid integer
|
||||
/// constant expression, and, if so, return its value in Result. If not a
|
||||
/// valid i-c-e, return false and fill in Loc (if specified) with the location
|
||||
|
|
|
@ -72,7 +72,7 @@ RValue CodeGenFunction::EmitAnyExprToTemp(const Expr *E, llvm::Value *AggLoc,
|
|||
|
||||
RValue CodeGenFunction::EmitReferenceBindingToExpr(const Expr* E,
|
||||
QualType DestType) {
|
||||
if (E->isLvalue(getContext()) == Expr::LV_Valid) {
|
||||
if (E->isLvalue(getContext()) == Expr::LV_Valid && !E->getBitField()) {
|
||||
// Emit the expr as an lvalue.
|
||||
LValue LV = EmitLValue(E);
|
||||
return RValue::get(LV.getAddress());
|
||||
|
|
|
@ -35,6 +35,9 @@ void test_scalar() {
|
|||
int a = 10;
|
||||
f(a);
|
||||
|
||||
struct { int bitfield : 3; } s = { 3 };
|
||||
f(s.bitfield)
|
||||
|
||||
f(10);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue