[clang] [clang] Don't lose track of explicit specializations of member functi… (PR #111267)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 5 22:32:33 PDT 2024


================
@@ -4206,18 +4206,14 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
         if (Function->hasAttr<ExcludeFromExplicitInstantiationAttr>())
           continue;
 
-        MemberSpecializationInfo *MSInfo =
-            Function->getMemberSpecializationInfo();
-        assert(MSInfo && "No member specialization information?");
-        if (MSInfo->getTemplateSpecializationKind()
-                                                 == TSK_ExplicitSpecialization)
+        TemplateSpecializationKind PrevTSK =
+            Function->getTemplateSpecializationKind();
+        if (PrevTSK == TSK_ExplicitSpecialization)
           continue;
----------------
zyn0217 wrote:

Yeah, I thought the bug was that somewhere we failed to handle `DependentFunctionTemplateSpecializationInfo`s, but after stepping into the codes, I realized that it is due to the latest TSK stored in `FunctionTemplateSpecializationInfo` rather than in the MSInfo. (We didn't update the TSK in MSInfo in CheckFunctionTemplateSpecialization)

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


More information about the cfe-commits mailing list