]> granicus.if.org Git - clang/commitdiff
Exclude vectors from Type::isScalar() predicate.
authorSteve Naroff <snaroff@apple.com>
Thu, 24 Jan 2008 22:55:05 +0000 (22:55 +0000)
committerSteve Naroff <snaroff@apple.com>
Thu, 24 Jan 2008 22:55:05 +0000 (22:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46328 91177308-0d34-0410-b5e6-96231b3b80d8

AST/Type.cpp
Sema/SemaExpr.cpp

index c078bee909143a128f6562bed51e8e9cca32fa67..6751a236e3cf51afd657f346d209fd760ac31c71 100644 (file)
@@ -476,7 +476,6 @@ bool Type::isScalarType() const {
     return false;
   }
   return isa<PointerType>(CanonicalType) || isa<ComplexType>(CanonicalType) ||
-         isa<VectorType>(CanonicalType) || 
          isa<ObjCQualifiedIdType>(CanonicalType);
 }
 
index 0c8e5e2315424831d6ed274749ceda6de09e3387..58e0f08e50da953f8f8c98334341f3d482629d86 100644 (file)
@@ -729,10 +729,11 @@ ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
   // C99 6.5.4p2: the cast type needs to be void or scalar and the expression
   // type needs to be scalar.
   if (!castType->isVoidType()) {  // Cast to void allows any expr type.
-    if (!castType->isScalarType())
+    if (!castType->isScalarType() && !castType->isVectorType())
       return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar, 
                   castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
-    if (!castExpr->getType()->isScalarType())
+    if (!castExpr->getType()->isScalarType() && 
+        !castExpr->getType()->isVectorType())
       return Diag(castExpr->getLocStart(), 
                   diag::err_typecheck_expect_scalar_operand, 
                   castExpr->getType().getAsString(),castExpr->getSourceRange());