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

I explained the reason of retainInnerDepths() 
[there](https://github.com/llvm/llvm-project/pull/207966#discussion_r3627949315)

I would not attribute it as a workaround, since this is mainly equivalent to 
what we have 
[discussed](https://github.com/llvm/llvm-project/pull/195995#discussion_r3203180576)
 in the initial patch and this way handled more situations where the recursive 
instantiation is not initiated through TransformTemplateParameterList.


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