[clang] [clang][Sema] Fix 'FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter' (PR #235816)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 26 23:40:26 PDT 2026
================
@@ -21252,9 +21252,27 @@ static void FixDependencyOfIdExpressionsInLambdaWithDependentObjectParameter(
if (MD->getType().isNull())
continue;
- const auto *Ty = MD->getType()->getAs<FunctionProtoType>();
- if (!Ty || !MD->isExplicitObjectMemberFunction() ||
- !Ty->getParamType(0)->isDependentType())
+ if (!MD->isExplicitObjectMemberFunction())
+ continue;
+
+ bool IsDependentObjectParam = [&]() {
+ const ParmVarDecl *ObjectParamDecl = MD->getParamDecl(0);
+ assert(ObjectParamDecl && "Shall explicit object parameter exist here.");
+
+ QualType ObjectParamType = ObjectParamDecl->getType();
+ if (!ObjectParamType->isDependentType())
+ return false;
+
+ // If we are in the middle of instantiation of signature, try to use
+ // the real type of the deduced explicit object parameter.
+ if (auto *CIS = SemaRef.CurrentInstantiationScope)
+ if (auto *Inst = CIS->getInstantiationOfIfExists(ObjectParamDecl))
+ ObjectParamType = cast<ParmVarDecl>(cast<Decl *>(*Inst))->getType();
----------------
zyn0217 wrote:
I thought we should be able to get the instantiated ones without looking up instantiation scope, can you explain how do we end up here with a dependent parameter decl?
https://github.com/llvm/llvm-project/pull/235816
More information about the cfe-commits
mailing list