[PATCH] D127351: clang: fix early substitution of alias templates

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 17:27:04 PDT 2022


rsmith added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:1872
   QualType Result = getSema().Context.getTemplateTypeParmType(
-      T->getDepth() - TemplateArgs.getNumSubstitutedLevels(), T->getIndex(),
-      T->isParameterPack(), NewTTPDecl);
+      getNewDepth(T->getDepth()), T->getIndex(), T->isParameterPack(),
+      NewTTPDecl);
----------------
mizvekov wrote:
> mark
Instead of adding the new `EarlySubstitution` flag and wiring it through everywhere, can you use the existing `MultiLevelTemplateArgumentList::getNewDepth` function? That already handles the case of a depth that's within the number of retained outer levels. We might need to set the number of retained outer levels properly when doing alias template substitution; I'm not sure if we do so currently and I suspect we don't.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127351/new/

https://reviews.llvm.org/D127351



More information about the cfe-commits mailing list