================
@@ -1876,11 +1901,25 @@ namespace {
TemplateParameterList *OrigTPL) {
if (!OrigTPL || !OrigTPL->size()) return OrigTPL;
+ std::optional<MultiLevelTemplateArgumentList> OldMLTAL;
+ // We need to preserve the lambda depth in parameter mapping.
+ // Otherwise the template argument deduction would fail, if we reduced
the
+ // depth too early.
+ if (SemaRef.inParameterMappingSubstitution() &&
+ getDepthAndIndex(OrigTPL->getParam(0)).first >=
+ TemplateArgs.getNumSubstitutedLevels())
+ OldMLTAL = ForgetSubstitution();
----------------
mizvekov wrote:
Would look cleaner if this used `ForgetSubstitutionRAII`.
Also, I don't see how the level check is necessary. The comment doesn't explain
it either.
https://github.com/llvm/llvm-project/pull/195995
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits