diff options
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Sema/vector-init.c | 6 |
3 files changed, 10 insertions, 1 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 8cd5e428833..cb947fadf77 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -385,6 +385,8 @@ def err_typecheck_vector_not_convertable : Error< "can't convert between vector values of different size (%0 and %1)">; def err_typecheck_ext_vector_not_typedef : Error< "ext_vector_type only applies to types, not variables">; +def err_unsupported_vector_size : Error< + "unsupported type %0 for vector_size attribute, please use on typedef">; def err_ext_vector_component_exceeds_length : Error< "vector component access exceeds type %0">; def err_ext_vector_component_requires_even : Error< diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 919f28ffec7..6e2cc699a71 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -207,7 +207,8 @@ static void HandleVectorSizeAttr(Decl *D, const AttributeList &Attr, Sema &S) { // vector arrays, and functions returning vectors. if (CurType->isPointerType() || CurType->isArrayType() || CurType->isFunctionType()) { - assert(0 && "HandleVector(): Complex type construction unimplemented"); + S.Diag(Attr.getLoc(), diag::err_unsupported_vector_size) << CurType; + return; /* FIXME: rebuild the type from the inside out, vectorizing the inner type. do { if (PointerType *PT = dyn_cast<PointerType>(canonType)) diff --git a/clang/test/Sema/vector-init.c b/clang/test/Sema/vector-init.c index d0d9cf053ed..6eab32425ad 100644 --- a/clang/test/Sema/vector-init.c +++ b/clang/test/Sema/vector-init.c @@ -15,3 +15,9 @@ float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0, 9.0 }; // expected-warning {{excess elements in array initializer}} + + +// rdar://6881069 +__attribute__((vector_size(16))) // expected-error {{unsupported type 'float (void)' for vector_size attribute, please use on typedef}} +float f1(void) { +} |

