[clang] [Clang][Sema] Use the correct lookup context when building overloaded 'operator->' in the current instantiation (PR #104458)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 08:55:07 PDT 2024


================
@@ -7939,7 +7927,14 @@ ExprResult Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base,
           }
         }
         return ExprError();
+      } else if (Result.isUnset()) {
+        // BuildOverloadedArrowExpr returns an empty expression to indicate
+        // that we need to build a dependent overloaded arrow expression.
----------------
sdkrystian wrote:

> I have 2 concerns with that 
> 1/ It's a bit too clever of an interface

Although I agree it's an imperfect interface, this is more of a "transitional" fix. Ideally we will build the full AST for calls to members of the current instantiation in the future. For now, the usage of `ExprEmpty` in this patch isn't unfounded so I think it's "good enough". Alternatively I can add a `bool& IsDependent` out parameter to implement this functionality. 

> 2/ We should make sure this can only happens in Sema, right? I wonder if we need an ActOnOverloadedArrowExpr to wrap that logic such that (it would duplicate the lookup code but i think that's a better outcome)

I'm not entirely sure what this means. Are you saying that we should expect the result to _not_ be `ExprEmpty` during instantiation?

https://github.com/llvm/llvm-project/pull/104458


More information about the cfe-commits mailing list