]> granicus.if.org Git - clang/commitdiff
Teach Type::isRealType() that vector types are never real types. All
authorDouglas Gregor <dgregor@apple.com>
Tue, 22 Jun 2010 23:13:52 +0000 (23:13 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 22 Jun 2010 23:13:52 +0000 (23:13 +0000)
of the callers of isRealType() already assumed this, and one of them
(increment/decrement) mistakenly permitted increments of vector types
because of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106596 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp
test/Sema/ext_vector_casts.c

index a8ead6d46ba1ad01c99e7d9f29864ec4f4599e92..af4b7eb3a643995ac9da3da71eff753585ba16cf 100644 (file)
@@ -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;
 }
 
index be09903e00f7839a40697f0436d898d9a2554abe..7b7b0caf0aaca865e0152e823c0c8f215b37376c 100644 (file)
@@ -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'}}
+}