forked from OSchip/llvm-project
Teach Type::isRealType() that vector types are never real types. All
of the callers of isRealType() already assumed this, and one of them (increment/decrement) mistakenly permitted increments of vector types because of it. llvm-svn: 106596
This commit is contained in:
parent
49b4d73451
commit
c646d13054
|
@ -585,8 +585,6 @@ bool Type::isRealType() const {
|
|||
BT->getKind() <= BuiltinType::LongDouble;
|
||||
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
|
||||
return TT->getDecl()->isEnum() && TT->getDecl()->isDefinition();
|
||||
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
|
||||
return VT->getElementType()->isRealType();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,3 +45,7 @@ static void test() {
|
|||
}
|
||||
|
||||
typedef __attribute__(( ext_vector_type(2) )) float2 vecfloat2; // expected-error{{invalid vector type 'float2'}}
|
||||
|
||||
void inc(float2 f2) {
|
||||
f2++; // expected-error{{cannot increment value of type 'float2'}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue