From 26e51781f9d55cdae764facf8fe773aa2adb4569 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 17 Jun 2013 21:09:57 +0000 Subject: [PATCH] Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184123 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ExprClassification.cpp | 7 +++++-- test/SemaCXX/vector.cpp | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp index 12510d6883..72f17669ed 100644 --- a/lib/AST/ExprClassification.cpp +++ b/lib/AST/ExprClassification.cpp @@ -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(E)->containsDuplicateElements() ? - Cl::CL_DuplicateVectorComponents : Cl::CL_LValue; + if (cast(E)->containsDuplicateElements()) + return Cl::CL_DuplicateVectorComponents; + if (cast(E)->isArrow()) + return Cl::CL_LValue; + return ClassifyInternal(Ctx, cast(E)->getBase()); // Simply look at the actual default argument. case Expr::CXXDefaultArgExprClass: diff --git a/test/SemaCXX/vector.cpp b/test/SemaCXX/vector.cpp index 4d2d064b32..37b586ca3a 100644 --- a/test/SemaCXX/vector.cpp +++ b/test/SemaCXX/vector.cpp @@ -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; -- 2.40.0