diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-02-13 17:29:58 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-02-13 17:29:58 +0000 |
commit | 2be9af95562beed66965b7ca731bd35df1de7711 (patch) | |
tree | 0e327149a8da47adc7a79e7ca23ddecf5dba60ba /clang | |
parent | 2bba901a3665b1493cbe5c4afed7f3e84d59df4c (diff) | |
download | bcm5719-llvm-2be9af95562beed66965b7ca731bd35df1de7711.tar.gz bcm5719-llvm-2be9af95562beed66965b7ca731bd35df1de7711.zip |
Fix a minor bug in isNullPointerConstant triggered by the linux
tgmath.h.
Note that there is another issue with tgmath.h, so mandel.c still
doesn't work.
llvm-svn: 47069
Diffstat (limited to 'clang')
-rw-r--r-- | clang/AST/Expr.cpp | 2 | ||||
-rw-r--r-- | clang/test/Sema/conditional-expr.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index c7a2005bc8f..f4da0f07516 100644 --- a/clang/AST/Expr.cpp +++ b/clang/AST/Expr.cpp @@ -995,7 +995,7 @@ bool Expr::isNullPointerConstant(ASTContext &Ctx) const { // Strip off a cast to void*, if it exists. if (const CastExpr *CE = dyn_cast<CastExpr>(this)) { // Check that it is a cast to void*. - if (const PointerType *PT = dyn_cast<PointerType>(CE->getType())) { + if (const PointerType *PT = CE->getType()->getAsPointerType()) { QualType Pointee = PT->getPointeeType(); if (Pointee.getQualifiers() == 0 && Pointee->isVoidType() && // to void* CE->getSubExpr()->getType()->isIntegerType()) // from int. diff --git a/clang/test/Sema/conditional-expr.c b/clang/test/Sema/conditional-expr.c index 813aaee9d0d..a21914c6d5c 100644 --- a/clang/test/Sema/conditional-expr.c +++ b/clang/test/Sema/conditional-expr.c @@ -31,5 +31,8 @@ void foo() { enum {xxx,yyy,zzz} e, *ee; short x; ee = ee ? &x : ee ? &i : &e; // expected-warning {{pointer type mismatch}} + + typedef void *asdf; + *(0 ? (asdf) 0 : &x) = 10; } |