diff options
author | Sam Weinig <sam.weinig@gmail.com> | 2009-09-14 18:17:16 +0000 |
---|---|---|
committer | Sam Weinig <sam.weinig@gmail.com> | 2009-09-14 18:17:16 +0000 |
commit | b0a22903c3c45065c03ce2c904802d01fd67e170 (patch) | |
tree | 6f7312e6290c1764835889c069dc9fc62c872f30 /lib/Sema | |
parent | f6412c6479e2027a35d74bd37869b50adc49b620 (diff) |
-Wchar-subscripts should not warn for unsigned char subscripts. Fixes PR4978.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 32d3e06e3e..4967599da3 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -1809,7 +1809,9 @@ Sema::ActOnArraySubscriptExpr(Scope *S, ExprArg Base, SourceLocation LLoc, return ExprError(Diag(LLoc, diag::err_typecheck_subscript_not_integer) << IndexExpr->getSourceRange()); - if (IndexExpr->getType()->isCharType() && !IndexExpr->isTypeDependent()) + QualType IndexTy = Context.getCanonicalType(IndexExpr->getType()); + if ((IndexTy == Context.CharTy || IndexTy == Context.SignedCharTy) + && !IndexExpr->isTypeDependent()) Diag(LLoc, diag::warn_subscript_is_char) << IndexExpr->getSourceRange(); // C99 6.5.2.1p1: "shall have type "pointer to *object* type". Similarly, |