forked from OSchip/llvm-project
Exclude vectors from Type::isScalar() predicate.
llvm-svn: 46328
This commit is contained in:
parent
f3d6d668b6
commit
d9d581fc7b
|
@ -476,7 +476,6 @@ bool Type::isScalarType() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isa<PointerType>(CanonicalType) || isa<ComplexType>(CanonicalType) ||
|
return isa<PointerType>(CanonicalType) || isa<ComplexType>(CanonicalType) ||
|
||||||
isa<VectorType>(CanonicalType) ||
|
|
||||||
isa<ObjCQualifiedIdType>(CanonicalType);
|
isa<ObjCQualifiedIdType>(CanonicalType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
// C99 6.5.4p2: the cast type needs to be void or scalar and the expression
|
||||||
// type needs to be scalar.
|
// type needs to be scalar.
|
||||||
if (!castType->isVoidType()) { // Cast to void allows any expr type.
|
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,
|
return Diag(LParenLoc, diag::err_typecheck_cond_expect_scalar,
|
||||||
castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
|
castType.getAsString(), SourceRange(LParenLoc, RParenLoc));
|
||||||
if (!castExpr->getType()->isScalarType())
|
if (!castExpr->getType()->isScalarType() &&
|
||||||
|
!castExpr->getType()->isVectorType())
|
||||||
return Diag(castExpr->getLocStart(),
|
return Diag(castExpr->getLocStart(),
|
||||||
diag::err_typecheck_expect_scalar_operand,
|
diag::err_typecheck_expect_scalar_operand,
|
||||||
castExpr->getType().getAsString(),castExpr->getSourceRange());
|
castExpr->getType().getAsString(),castExpr->getSourceRange());
|
||||||
|
|
Loading…
Reference in New Issue