[clang] [Clang] Fixed UnresolvedLookupExpr propagating into the codegen phase (PR #124609)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 13 07:50:16 PDT 2025


================
@@ -14228,9 +14228,15 @@ ExprResult Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn,
     const FunctionDecl *FDecl = Best->Function;
     if (FDecl && FDecl->isTemplateInstantiation() &&
         FDecl->getReturnType()->isUndeducedType()) {
+
+      // As there'll be no attempt to resolve UnresolvedLookupExpr again inside
+      // non-dependent context, skip considering it as type-dependent.
+      const DeclContext *DC = CurContext;
+      const bool Resolvable = DC && DC->isDependentContext();
----------------
erichkeane wrote:

`Resolvable` isn't a good name here, it sorta implies the opposite of what we mean, but not to the point of `NotResolvable` being a good idea.  I think just putting `&& CurContext->isDependentContext()` below is actually more readable.  Also, you don't really have to check the `DeclContext`, having a null one I think requires that you be outside of a `TranslationUnitDecl`, which isn't possible. 

I see that we are just going through `FinishOverloadedCallExpr` in the event that we are going to instantiate this again, which I guess makes sense, since this is creating a call with a `DependentTy`, but this comment doesn't make it clear what i   I think I'd be happy with a better commit message explaining the whole situation and why this works.  I've debugged a while and think I have a good hold on it though, so just a better description I think would help

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


More information about the cfe-commits mailing list