================
@@ -3761,13 +3761,17 @@ Decl 
*TemplateDeclInstantiator::VisitNonTypeTemplateParmDecl(
   if (IsExpandedParameterPack)
     Param = NonTypeTemplateParmDecl::Create(
         SemaRef.Context, Owner, D->getInnerLocStart(), D->getLocation(),
-        D->getDepth() - TemplateArgs.getNumSubstitutedLevels(),
+        D->getDepth() - (TemplateArgs.retainInnerDepths()
+                             ? 0
+                             : TemplateArgs.getNumSubstitutedLevels()),
         D->getPosition(), D->getIdentifier(), T, TSI,
         ExpandedParameterPackTypes, ExpandedParameterPackTypesAsWritten);
   else
     Param = NonTypeTemplateParmDecl::Create(
         SemaRef.Context, Owner, D->getInnerLocStart(), D->getLocation(),
-        D->getDepth() - TemplateArgs.getNumSubstitutedLevels(),
+        D->getDepth() - (TemplateArgs.retainInnerDepths()
+                             ? 0
+                             : TemplateArgs.getNumSubstitutedLevels()),
----------------
zyn0217 wrote:

Ugh, I don't think I have any tests? Some of our longstanding issues were 
actually fixed by the 'wrong' preservation patch, which IIRC there should have 
been cases where lambdas are nested within a template parameter type?

That said, I'm still unclear what we should do to move forward: do you consider 
it necessary to convert everything to Rewrite, at the risk of rewriting almost 
everything since #161671? Note that some of our cases are dependent on your 
several NTTP patches, which I think it already makes the situation worse to 
move forward to that direction.

I agree it's a bit arbitrary to introduce the third mode flag outside of that 
enumeration, and we could always refactor it.

Again @cor3ntin for opinions

https://github.com/llvm/llvm-project/pull/210381
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to