llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: William Tran-Viet (smallp-o-p)

<details>
<summary>Changes</summary>

Fixes #<!-- -->116932 

---
Full diff: https://github.com/llvm/llvm-project/pull/118186.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaExprMember.cpp (+3-1) 
- (modified) clang/test/SemaCXX/vector-bool.cpp (+4-4) 


``````````diff
diff --git a/clang/lib/Sema/SemaExprMember.cpp 
b/clang/lib/Sema/SemaExprMember.cpp
index 434768b99d631e..3d843bb84d9d8b 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -1655,8 +1655,10 @@ static ExprResult LookupMemberExpr(Sema &S, LookupResult 
&R,
     // We disallow element access for ext_vector_type bool.  There is no way to
     // materialize a reference to a vector element as a pointer (each element 
is
     // one bit in the vector).
+    assert(MemberName.isIdentifier() &&
+           "Ext vector component name not an identifier!");
     S.Diag(R.getNameLoc(), diag::err_ext_vector_component_name_illegal)
-        << MemberName
+        << MemberName.getAsIdentifierInfo()->getName()
         << (BaseExpr.get() ? BaseExpr.get()->getSourceRange() : SourceRange());
     return ExprError();
   }
diff --git a/clang/test/SemaCXX/vector-bool.cpp 
b/clang/test/SemaCXX/vector-bool.cpp
index e99d420e73fab2..cd638056f348b0 100644
--- a/clang/test/SemaCXX/vector-bool.cpp
+++ b/clang/test/SemaCXX/vector-bool.cpp
@@ -85,10 +85,10 @@ void foo(const bool& X);
 
 // Disallow element-wise access.
 bool* ElementRefs() {
-  eight_bools.y = false; // expected-error@88 {{illegal vector component name 
''y''}}
-  &eight_bools.z;        // expected-error@89 {{illegal vector component name 
''z''}}
-  foo(eight_bools.w);    // expected-error@90 {{illegal vector component name 
''w''}}
-  foo(eight_bools.wyx);  // expected-error@91 {{illegal vector component name 
''wyx''}}
+  eight_bools.y = false; // expected-error@88 {{illegal vector component name 
'y'}}
+  &eight_bools.z;        // expected-error@89 {{illegal vector component name 
'z'}}
+  foo(eight_bools.w);    // expected-error@90 {{illegal vector component name 
'w'}}
+  foo(eight_bools.wyx);  // expected-error@91 {{illegal vector component name 
'wyx'}}
 }
 
 void Sizeof() {

``````````

</details>


https://github.com/llvm/llvm-project/pull/118186
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to