return ExprError(Diag(LLoc, diag::err_typecheck_subscript_not_integer)
<< IndexExpr->getSourceRange());
- QualType IndexTy = Context.getCanonicalType(IndexExpr->getType());
- if ((IndexTy == Context.CharTy || IndexTy == Context.SignedCharTy)
- && !IndexExpr->isTypeDependent())
+ if ((IndexExpr->getType()->isSpecificBuiltinType(BuiltinType::Char_S) ||
+ IndexExpr->getType()->isSpecificBuiltinType(BuiltinType::Char_U))
+ && !IndexExpr->isTypeDependent())
Diag(LLoc, diag::warn_subscript_is_char) << IndexExpr->getSourceRange();
// C99 6.5.2.1p1: "shall have type "pointer to *object* type". Similarly,
void t6() {
int array[1] = { 0 };
signed char subscript = 0;
- int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
+ int val = array[subscript]; // no warning for explicit signed char
}
void t7() {
void t9() {
int array[1] = { 0 };
SignedCharTy subscript = 0;
- int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
+ int val = array[subscript]; // no warning for explicit signed char
}
typedef unsigned char UnsignedCharTy;