[clang] [clang][Sema] Use original template pattern when declaring implicit deduction guides for nested template classes (PR #68379)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 14:46:15 PDT 2023


antangelo wrote:

When `SubstType` is called on the `const inner &` parameter to substitute the outer template args, it eventually calls `FindInstantiatedDecl` on the inner template pattern. The presence of the explicit deduction guide causes the outer template to already be instantiated at this point.

As a result `FindInstantiatedDecl` attempts to look for the inner template within the instantiated outer template. This fails because the inner template args are not known (so the inner template cannot have been instantiated at this point).

I think that in this case, if the decl passed into `FindInstantiatedDecl` is a `CXXRecordDecl` with a described template, and its context is dependent at the given template arguments' level, `FindInstantiatedDecl` should return the template pattern. Does that make sense, or is it off the mark?

https://github.com/llvm/llvm-project/pull/68379


More information about the cfe-commits mailing list