]> granicus.if.org Git - clang/commitdiff
Add diagnostic for .{lo,hi,e,o} on odd-sized extended vectors.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 30 Sep 2008 17:22:47 +0000 (17:22 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 30 Sep 2008 17:22:47 +0000 (17:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56859 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticKinds.def
lib/Sema/SemaExpr.cpp

index 84aa391437853331306fa129c1534af14104410c..1e9580c3ce1119c805ed27c3353798a6872c130c 100644 (file)
@@ -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,
index b19da68abee205c406433c069d8565e65678a739..07428fdac7b9a3e2696978bae2a76384159bd73a 100644 (file)
@@ -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();
   }