From: Steve Naroff Date: Thu, 24 Jan 2008 22:55:05 +0000 (+0000) Subject: Exclude vectors from Type::isScalar() predicate. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9412d6813137323cd2bd5daeeabb2f5ad2c1d626;p=clang Exclude vectors from Type::isScalar() predicate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46328 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/Type.cpp b/AST/Type.cpp index c078bee909..6751a236e3 100644 --- a/AST/Type.cpp +++ b/AST/Type.cpp @@ -476,7 +476,6 @@ bool Type::isScalarType() const { return false; } return isa(CanonicalType) || isa(CanonicalType) || - isa(CanonicalType) || isa(CanonicalType); } diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp index 0c8e5e2315..58e0f08e50 100644 --- a/Sema/SemaExpr.cpp +++ b/Sema/SemaExpr.cpp @@ -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());