]> granicus.if.org Git - clang/commitdiff
Fix a minor bug in isNullPointerConstant triggered by the linux
authorEli Friedman <eli.friedman@gmail.com>
Wed, 13 Feb 2008 17:29:58 +0000 (17:29 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 13 Feb 2008 17:29:58 +0000 (17:29 +0000)
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

AST/Expr.cpp
test/Sema/conditional-expr.c

index c7a2005bc8f3ae52e7607edbad41cbcc92cf881f..f4da0f0751620ebd49e0e30c1b4d0812b7568abb 100644 (file)
@@ -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.
index 813aaee9d0d15fd8479102de56e75dc57737dd42..a21914c6d5ccb6b0aa200bc5d72c7ab2387a0725 100644 (file)
@@ -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;
 }