if (!lhs->isArithmeticType() || !rhs->isArithmeticType())
return lhs;
+ // Perform bitfield promotions.
+ QualType LHSBitfieldPromoteTy = isPromotableBitField(lhsExpr, Context);
+ if (!LHSBitfieldPromoteTy.isNull())
+ lhs = LHSBitfieldPromoteTy;
+ QualType RHSBitfieldPromoteTy = isPromotableBitField(rhsExpr, Context);
+ if (!RHSBitfieldPromoteTy.isNull())
+ rhs = RHSBitfieldPromoteTy;
+
QualType destType = UsualArithmeticConversionsType(lhs, rhs);
if (!isCompAssign)
ImpCastExprToType(lhsExpr, destType);
QualType LHSTy = lex->getType();
if (LHSTy->isPromotableIntegerType())
LHSTy = Context.IntTy;
+ else {
+ QualType T = isPromotableBitField(lex, Context);
+ if (!T.isNull())
+ LHSTy = T;
+ }
+
*CompLHSTy = LHSTy;
}
return PExp->getType();
QualType LHSTy;
if (lex->getType()->isPromotableIntegerType())
LHSTy = Context.IntTy;
- else
- LHSTy = lex->getType();
+ else {
+ LHSTy = isPromotableBitField(lex, Context);
+ if (LHSTy.isNull())
+ LHSTy = lex->getType();
+ }
if (!isCompAssign)
ImpCastExprToType(lex, LHSTy);
// C99 6.5.16.1p2: In simple assignment, the value of the right operand
// is converted to the type of the assignment expression (above).
// C++ 5.17p1: the type of the assignment expression is that of its left
- // oprdu.
+ // operand.
return LHSType.getUnqualifiedType();
}