]> granicus.if.org Git - clang/commitdiff
Check in a couple fixes for vector extensions.
authorNate Begeman <natebegeman@mac.com>
Mon, 17 Mar 2008 17:22:18 +0000 (17:22 +0000)
committerNate Begeman <natebegeman@mac.com>
Mon, 17 Mar 2008 17:22:18 +0000 (17:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48461 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp

index d756345c1a8617d9996d62b9e7390310e411f3b1..8df023f238783402dfe80902fc2762174af83226 100644 (file)
@@ -547,7 +547,7 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
                           MemberLoc, MemberType);
   } else if (BaseType->isOCUVectorType() && OpKind == tok::period) {
     // Component access limited to variables (reject vec4.rg.g).
-    if (!isa<DeclRefExpr>(BaseExpr)
+    if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr))
       return Diag(OpLoc, diag::err_ocuvector_component_access, 
                   SourceRange(MemberLoc));
     QualType ret = CheckOCUVectorComponent(BaseType, OpLoc, Member, MemberLoc);
@@ -1284,7 +1284,7 @@ inline QualType Sema::CheckVectorOperands(SourceLocation loc, Expr *&lex,
   QualType lhsType = lex->getType(), rhsType = rex->getType();
   
   // make sure the vector types are identical. 
-  if (lhsType == rhsType)
+  if (lhsType.getCanonicalType() == rhsType.getCanonicalType())
     return lhsType;
 
   // if the lhs is an ocu vector and the rhs is a scalar of the same type,