[clang] [Clang] [Sema] Fix crash instantiating a member variable template partial specialization when the enclosing class template is deserialized (PR #202958)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 20:17:21 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.
----------------
ChuanqiXu9 wrote:
If the deserialization has errors, we should fix that.
https://github.com/llvm/llvm-project/pull/202958
More information about the cfe-commits
mailing list