aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDeclAttr.cpp5
-rw-r--r--test/Sema/types.c3
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 6e2cc699a7..711f5f937f 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -221,8 +221,9 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) {
canonType->isFunctionType());
*/
}
- // the base type must be integer or float.
- if (!CurType->isIntegerType() && !CurType->isRealFloatingType()) {
+ // the base type must be integer or float, and can't already be a vector.
+ if (CurType->isVectorType() ||
+ (!CurType->isIntegerType() && !CurType->isRealFloatingType())) {
S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
return;
}
diff --git a/test/Sema/types.c b/test/Sema/types.c
index 1232e472ea..e7d4b00a4d 100644
--- a/test/Sema/types.c
+++ b/test/Sema/types.c
@@ -34,3 +34,6 @@ int j[42]; // expected-error {{redefinition of 'j' with a different type}}
// rdar://6880104
_Decimal32 x; // expected-error {{GNU decimal type extension not supported}}
+
+// rdar://6880951
+int __attribute__ ((vector_size (8), vector_size (8))) v; // expected-error {{invalid vector type}}