[cfe-commits] r84953 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaTemplate/ext-vector-type.cpp
John McCall
rjmccall at apple.com
Fri Oct 23 10:55:46 PDT 2009
Author: rjmccall
Date: Fri Oct 23 12:55:45 2009
New Revision: 84953
URL: http://llvm.org/viewvc/llvm-project?rev=84953&view=rev
Log:
Rebuild dependently-sized ext vectors if either the element type or the size
changed under the transform.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/ext-vector-type.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=84953&r1=84952&r2=84953&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Fri Oct 23 12:55:45 2009
@@ -2331,7 +2331,8 @@
QualType Result = TL.getType();
if (getDerived().AlwaysRebuild() ||
- (ElementType != T->getElementType() && Size.get() != T->getSizeExpr())) {
+ ElementType != T->getElementType() ||
+ Size.get() != T->getSizeExpr()) {
Result = getDerived().RebuildDependentSizedExtVectorType(ElementType,
move(Size),
T->getAttributeLoc());
Modified: cfe/trunk/test/SemaTemplate/ext-vector-type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/ext-vector-type.cpp?rev=84953&r1=84952&r2=84953&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/ext-vector-type.cpp (original)
+++ cfe/trunk/test/SemaTemplate/ext-vector-type.cpp Fri Oct 23 12:55:45 2009
@@ -45,3 +45,16 @@
typedef int_ptr __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type}}
};
+template<int Length>
+struct make6 {
+ typedef int __attribute__((ext_vector_type(Length))) type;
+};
+
+int test_make6() {
+ make6<4>::type x;
+ x.w = 7;
+
+ make6<2>::type y;
+ y.x = -1;
+ y.w = -1; // expected-error{{vector component access exceeds type}}
+}
More information about the cfe-commits
mailing list