================ @@ -2442,11 +2489,21 @@ ExprResult TemplateInstantiator::TransformSubstNonTypeTemplateParmExpr( SubstNonTypeTemplateParmExpr *E) { ExprResult SubstReplacement = E->getReplacement(); + QualType ParamType = E->getParameterType(getSema().Context); + bool WasDependentLambda = false; + if (auto *RT = dyn_cast<RecordType>(ParamType); + RT && RT->getAsCXXRecordDecl()) + WasDependentLambda = RT->getAsCXXRecordDecl()->isDependentLambda(); if (!isa<ConstantExpr>(SubstReplacement.get())) SubstReplacement = TransformExpr(E->getReplacement()); if (SubstReplacement.isInvalid()) return true; - QualType SubstType = TransformType(E->getParameterType(getSema().Context)); + // FIXME: This transform cannot find the instantiated lambda declaration + // because lambdas are instantiated in a unique scope. + QualType SubstType = + WasDependentLambda + ? SubstReplacement.get()->getType().getUnqualifiedType() + : TransformType(ParamType); ---------------- zyn0217 wrote:
This looks like a merge error... https://github.com/llvm/llvm-project/pull/141776 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits