[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

Liming Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 06:33:28 PDT 2022


lime added a comment.

> which isn't clear to me what you mean

- In the function `Sema::CheckTemplateArgument` at line 5725, `Params` has been substituted in a way all `TemplateTypeParmDecl`s are instantiated with a smaller depth, and so are constraints of them at SemaTemplateInstantiateDecl.cpp:2769, while the requires clause remains the same.
- Then `CheckTemplateArgument` calls `CheckTemplateTemplateArgument` which calls `IsAtLeastAsConstrained` with the original declaration and the constraints collected from `Params`. Thus, in `IsAtLeastAsConstrained`, a depth calculated from the declaration will not reflect the depth in the constraint.
- It should be fine to not adjust the depths between two constraints passed to `IsAtLeastAsConstrained` if the requires clause is not parsed, as they are already the same. But it is not the case when the constraint is from a requires clause, as requires clauses are not substituted. However, calculating from declarations will break the original case.

> I wouldn't expect the requires clause (nor any other concept related AST node) to be instantiated at all until it is going through 'checking'

The function `TemplateDeclInstantiator::SubstTemplateParams` instantiates constraints like `template <template <C T> class>`, so it is already happened.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134128



More information about the cfe-commits mailing list