================
@@ -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();
----------------
zyn0217 wrote:
> I am not sure I understand why changing the depth is a problem for deduction,
> because deduction accepts the template depth as a parameter and this should
> be easy to figure out for the lambda since it has template parameters.
It's all about the collection of explicit template arguments:
`PackDeductionScope::finishConstruction` requires a depth-level-match of
template parameters.
And I don't think we can add template depth to deduction to the code path that
performs a deduction on a function call? we seem to always assume their depths
are 0.
https://github.com/llvm/llvm-project/pull/195995
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits