From: Daniel Dunbar Date: Tue, 30 Sep 2008 17:22:47 +0000 (+0000) Subject: Add diagnostic for .{lo,hi,e,o} on odd-sized extended vectors. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=abee2d789ce799ce9a5d611e13a1713090f305f3;p=clang Add diagnostic for .{lo,hi,e,o} on odd-sized extended vectors. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56859 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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(); }