[all-commits] [llvm/llvm-project] bee78b: Reland "[clang][Sema] Use original template patter...

antangelo via All-commits all-commits at lists.llvm.org
Sat Nov 25 11:26:57 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bee78b88f8effdb378a809e0416988ce9c37f5ac
      https://github.com/llvm/llvm-project/commit/bee78b88f8effdb378a809e0416988ce9c37f5ac
  Author: antangelo <contact at antangelo.com>
  Date:   2023-11-25 (Sat, 25 Nov 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/SemaTemplate/nested-deduction-guides.cpp
    A clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp

  Log Message:
  -----------
  Reland "[clang][Sema] Use original template pattern when declaring implicit deduction guides for nested template classes" (#73087)

Reland of f418319730341e9d41ce8ead6fbfe5603c343985 with proper handling
of template constructors

When a nested template is instantiated, the template pattern of the
inner class is not copied into the outer class
ClassTemplateSpecializationDecl. The specialization contains a
ClassTemplateDecl with an empty record that points to the original
template pattern instead.

As a result, when looking up the constructors of the inner class, no
results are returned. This patch finds the original template pattern and
uses that for the lookup instead.

Based on CWG2471 we must also substitute the known outer template
arguments when creating deduction guides for the inner class.

Changes from last iteration:

1. In template constructors, arguments are first rewritten to depth - 1
relative to the constructor as compared to depth 0 originally. These
arguments are needed for substitution into constraint expressions.
2. Outer arguments are then applied with the template instantiator to
produce a template argument at depth zero for use in the deduction
guide. This substitution does not evaluate constraints, which preserves
constraint arguments at the correct depth for later evaluation.
3. Tests are added that cover template constructors within nested
deduction guides for all special substitution cases.
4. Computation of the template pattern and outer instantiation arguments
are pulled into the constructor of
`ConvertConstructorToDeductionGuideTransform`.




More information about the All-commits mailing list