bool IsCompAssign) {
checkArithmeticNull(*this, LHS, RHS, Loc, /*isCompare=*/false);
- // C99 6.5.7p2: Each of the operands shall have integer type.
- if (!LHS.get()->getType()->hasIntegerRepresentation() ||
- !RHS.get()->getType()->hasIntegerRepresentation())
- return InvalidOperands(Loc, LHS, RHS);
-
- // C++0x: Don't allow scoped enums. FIXME: Use something better than
- // hasIntegerRepresentation() above instead of this.
- if (isScopedEnumerationType(LHS.get()->getType()) ||
- isScopedEnumerationType(RHS.get()->getType())) {
- return InvalidOperands(Loc, LHS, RHS);
- }
-
// Vector shifts promote their scalar inputs to vector type.
if (LHS.get()->getType()->isVectorType() ||
RHS.get()->getType()->isVectorType())
RHS = UsualUnaryConversions(RHS.take());
if (RHS.isInvalid())
return QualType();
+ QualType RHSType = RHS.get()->getType();
+
+ // C99 6.5.7p2: Each of the operands shall have integer type.
+ if (!LHSType->hasIntegerRepresentation() ||
+ !RHSType->hasIntegerRepresentation())
+ return InvalidOperands(Loc, LHS, RHS);
+ // C++0x: Don't allow scoped enums. FIXME: Use something better than
+ // hasIntegerRepresentation() above instead of this.
+ if (isScopedEnumerationType(LHSType) ||
+ isScopedEnumerationType(RHSType)) {
+ return InvalidOperands(Loc, LHS, RHS);
+ }
// Sanity-check shift operands
DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType);