]> granicus.if.org Git - clang/commitdiff
Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.
authorEli Friedman <eli.friedman@gmail.com>
Mon, 17 Jun 2013 21:09:57 +0000 (21:09 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 17 Jun 2013 21:09:57 +0000 (21:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184123 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprClassification.cpp
test/SemaCXX/vector.cpp

index 12510d688309bf1038b6bfd819c81aff4caf9e7e..72f17669ed17d1a4cc18e40a6955105c78f07036 100644 (file)
@@ -291,8 +291,11 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
     // Extended vector element access is an lvalue unless there are duplicates
     // in the shuffle expression.
   case Expr::ExtVectorElementExprClass:
-    return cast<ExtVectorElementExpr>(E)->containsDuplicateElements() ?
-      Cl::CL_DuplicateVectorComponents : Cl::CL_LValue;
+    if (cast<ExtVectorElementExpr>(E)->containsDuplicateElements())
+      return Cl::CL_DuplicateVectorComponents;
+    if (cast<ExtVectorElementExpr>(E)->isArrow())
+      return Cl::CL_LValue;
+    return ClassifyInternal(Ctx, cast<ExtVectorElementExpr>(E)->getBase());
 
     // Simply look at the actual default argument.
   case Expr::CXXDefaultArgExprClass:
index 4d2d064b32f1806ec9f5447ae09840920d043423..37b586ca3a983b53df2d32f9f9408694fa42bae2 100644 (file)
@@ -278,3 +278,7 @@ void test_pseudo_dtor(fltx4 *f) {
   (*f).~fltx4();
   test_pseudo_dtor_tmpl(f);
 }
+
+// PR16204
+typedef __attribute__((ext_vector_type(4))) int vi4;
+const int &reference_to_vec_element = vi4(1).x;