[libcxx-commits] [clang] [libcxx] [Clang] Normalize constraints before checking for satisfaction (PR #141776)

Younan Zhang via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 19 02:37:06 PDT 2025


================
@@ -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


More information about the libcxx-commits mailing list