[clang] [Clang] [Sema] Fix crash instantiating a member variable template partial specialization when the enclosing class template is deserialized (PR #202958)
Shengxin Pei via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 30 20:54:27 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.
----------------
TPPPP72 wrote:
Yes, that's what I'm concerning about. These asserts are making sense. So bypassing them is hiding the root cause.
https://github.com/llvm/llvm-project/pull/202958
More information about the cfe-commits
mailing list