]> granicus.if.org Git - clang/commitdiff
Tweak to Expr::isIntegerConstantExpr...make sure the result is appropriately size...
authorSteve Naroff <snaroff@apple.com>
Thu, 2 Aug 2007 04:09:23 +0000 (04:09 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 2 Aug 2007 04:09:23 +0000 (04:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40716 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Expr.cpp

index 8f1335c33386388628e1bc1fc6ac6822ef256246..44e8271bdb5129385842dba0ae982ac702e4b835 100644 (file)
@@ -305,9 +305,12 @@ bool Expr::isIntegerConstantExpr(llvm::APSInt &Result, ASTContext &Ctx,
     Result.setIsUnsigned(!getType()->isSignedIntegerType());
     break;
   }
-  case TypesCompatibleExprClass:
-    Result = cast<TypesCompatibleExpr>(this)->typesAreCompatible();
+  case TypesCompatibleExprClass: {
+    const TypesCompatibleExpr *TCE = cast<TypesCompatibleExpr>(this);
+    Result.zextOrTrunc(Ctx.getTypeSize(getType(), TCE->getLocStart()));                              
+    Result = TCE->typesAreCompatible();
     break;
+  }
   case DeclRefExprClass:
     if (const EnumConstantDecl *D = 
           dyn_cast<EnumConstantDecl>(cast<DeclRefExpr>(this)->getDecl())) {