================
@@ -1428,6 +1428,16 @@ void ResultBuilder::AddResult(Result R, DeclContext 
*CurContext,
 
   AdjustResultPriorityForDecl(R);
 
+  if (isa<FieldDecl>(R.Declaration)) {
+    // If result is a member in the context of an explicit-object member
+    // function, drop it because it must be accessed through the object
+    // parameter
+    if (auto *MethodDecl = dyn_cast<CXXMethodDecl>(CurContext);
----------------
MythreyaK wrote:

How do we ensure that explicit object methods still participate in overload 
resolution, since the `HasObjectTypeQualifiers` is `false` 
[here](https://searchfox.org/llvm/rev/a293573c4e3e43f9f6279f075c3262ea5dc17086/clang/lib/Sema/SemaCodeComplete.cpp#1431)?
 

Example, his does not suggest `memberFnB`

```cpp
struct A {
  int member {};
  int memberFnA(int a);
  int memberFnB(this A const& self, float b);

  void foo(this const A& self) {
    self.mem^ // suggests only 'member'
    self.memberFnA(1); // correctly diagnosed by clangd
  }
};
```

Should `HasObjectTypeQualifiers` be true for these? 

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

Reply via email to