[clang] [Clang] [Sema] Fix crash instantiating a member variable template partial specialization when the enclosing class template is deserialized (PR #202958)

Rex Technology via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 03:14:24 PDT 2026


================
@@ -2534,11 +2534,21 @@ Decl *TemplateDeclInstantiator::VisitVarTemplatePartialSpecializationDecl(
   VarTemplateDecl *VarTemplate = D->getSpecializedTemplate();
 
   // Lookup the already-instantiated declaration and return that.
+  //
+  // The primary member variable template is normally instantiated into Owner
+  // before its partial specializations, because it is declared first. That may
+  // not hold when the enclosing class template is deserialized from a PCH or
+  // module built with errors, so instantiate the primary on demand here.
----------------
RexTechnology1 wrote:

Right, I'll look into the deserialization path and restore Sema to trunk.

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


More information about the cfe-commits mailing list