QualType CondTypeBeforePromotion =
GetTypeBeforeIntegralPromotion(CondExpr);
- if (getLangOptions().CPlusPlus &&
+ if (getLangOptions().CPlusPlus &&
CheckCXXSwitchCondition(*this, SwitchLoc, CondExpr))
- return StmtError();
+ return StmtError();
+ // C99 6.8.4.2p5 - Integer promotions are performed on the controlling expr.
+ UsualUnaryConversions(CondExpr);
QualType CondType = CondExpr->getType();
SS->setCond(CondExpr);
return StmtError();
}
- UsualUnaryConversions(CondExpr);
-
if (CondTypeBeforePromotion->isBooleanType()) {
// switch(bool_expr) {...} is often a programmer error, e.g.
// switch(n && mask) { ... } // Doh - should be "n & mask".