================
@@ -2697,6 +2697,14 @@ void 
ASTDeclReader::VisitVarTemplatePartialSpecializationDecl(
 
   RedeclarableResult Redecl = VisitVarTemplateSpecializationDeclImpl(D);
 
+  // A partial specialization whose primary template is invalid cannot be
+  // instantiated. Mark it invalid too so InstantiateClass skips it, the same
+  // way it already skips the invalid primary, instead of later looking for an
+  // instantiated primary that was never created.
+  if (VarTemplateDecl *Primary = D->getSpecializedTemplate();
+      Primary && Primary->isInvalidDecl())
+    D->setInvalidDecl();
----------------
mizvekov wrote:

Can we address the root cause instead? Why does this not crash without 
serialization, but does with it?

https://github.com/llvm/llvm-project/pull/202958
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to