================ @@ -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(); ---------------- ricejasonf wrote:
The comments for that states ```cpp /// Retrieve the record declaration from which this record could be /// instantiated. Returns null if this class is not a template instantiation. const CXXRecordDecl *getTemplateInstantiationPattern() const; ``` So the "pattern" as I read it, is not an instantiation itself but the template (or partial specialization). In the case of the field in `struct L` we need the intermediate instantiated struct to get the instantiated field. https://github.com/llvm/llvm-project/pull/121225 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits