forked from OSchip/llvm-project
Make sure Sema::CheckIncrementDecrementOperand() removes typedefs when doing it's analysis.
Thanks to Seo Sanghyeon for his excellent (first) bug fix! llvm-svn: 43994
This commit is contained in:
parent
a468a11d80
commit
5f9ae64f6e
|
@ -1414,7 +1414,7 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *op, SourceLocation OpLoc) {
|
||||||
assert(!resType.isNull() && "no type for increment/decrement expression");
|
assert(!resType.isNull() && "no type for increment/decrement expression");
|
||||||
|
|
||||||
// C99 6.5.2.4p1: We allow complex as a GCC extension.
|
// C99 6.5.2.4p1: We allow complex as a GCC extension.
|
||||||
if (const PointerType *pt = dyn_cast<PointerType>(resType)) {
|
if (const PointerType *pt = resType->getAsPointerType()) {
|
||||||
if (!pt->getPointeeType()->isObjectType()) { // C99 6.5.2.4p2, 6.5.6p2
|
if (!pt->getPointeeType()->isObjectType()) { // C99 6.5.2.4p2, 6.5.6p2
|
||||||
Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
|
Diag(OpLoc, diag::err_typecheck_arithmetic_incomplete_type,
|
||||||
resType.getAsString(), op->getSourceRange());
|
resType.getAsString(), op->getSourceRange());
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
// RUN: clang -fsyntax-only -verify %s
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
typedef int *pint;
|
||||||
|
int main() {
|
||||||
|
int a[5] = {0};
|
||||||
|
pint p = a;
|
||||||
|
p++;
|
||||||
|
printf("%d\n", *p);
|
||||||
|
}
|
Loading…
Reference in New Issue