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 | 4b3f9b367c16e494c181d6f03d53497ae1275fbe (patch) | |
tree | 6057db09e84a1f08bdfb8f454475bb27a51e4ea2 | |
parent | 24f1a967741ff9f8025ee23be12ba6feacc31f77 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47069 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | AST/Expr.cpp | 2 | ||||
-rw-r--r-- | test/Sema/conditional-expr.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/AST/Expr.cpp b/AST/Expr.cpp index c7a2005bc8..f4da0f0751 100644 --- a/AST/Expr.cpp +++ b/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/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 813aaee9d0..a21914c6d5 100644 --- a/test/Sema/conditional-expr.c +++ b/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; } |