[clang] [Clang][P1061] Fix template arguments in local classes (PR #121225)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 13 08:33:02 PDT 2025
================
@@ -4433,8 +4433,12 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
// No need to instantiate in-class initializers during explicit
// instantiation.
if (Field->hasInClassInitializer() && TSK == TSK_ImplicitInstantiation) {
+ // Handle local classes which could have substituted template params.
CXXRecordDecl *ClassPattern =
- Instantiation->getTemplateInstantiationPattern();
+ Instantiation->isLocalClass()
+ ? Instantiation->getInstantiatedFromMemberClass()
+ : Instantiation->getTemplateInstantiationPattern();
----------------
mizvekov wrote:
Yes, the pattern is the corpus of the template, the parts which needs to be have template parameters replaced in order to produce an instantiation.
I think what I said still stands.
https://github.com/llvm/llvm-project/pull/121225
More information about the cfe-commits
mailing list