diff options
-rw-r--r-- | include/clang/Basic/DiagnosticKinds.def | 2 | ||||
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/include/clang/Basic/DiagnosticKinds.def b/include/clang/Basic/DiagnosticKinds.def index 84aa391437..1e9580c3ce 100644 --- a/include/clang/Basic/DiagnosticKinds.def +++ b/include/clang/Basic/DiagnosticKinds.def @@ -678,6 +678,8 @@ DIAG(err_typecheck_ext_vector_not_typedef, ERROR, "ext_vector_type only applies to types, not variables") DIAG(err_ext_vector_component_exceeds_length, ERROR, "vector component access exceeds type '%0'") +DIAG(err_ext_vector_component_requires_even, ERROR, + "vector component access invalid for odd-sized type '%0'") DIAG(err_ext_vector_component_name_illegal, ERROR, "illegal vector component name '%0'") DIAG(err_ext_vector_component_access, ERROR, diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index b19da68abe..07428fdac7 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -846,6 +846,8 @@ CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc, // is an even number, since all special component names return exactly half // the elements. if (SpecialComponent && (vecType->getNumElements() & 1U)) { + Diag(OpLoc, diag::err_ext_vector_component_requires_even, + baseType.getAsString(), SourceRange(CompLoc)); return QualType(); } |