[clang] [clang][AST] Value-initialize deserialized concept specialization args (PR #222148)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 14 03:46:24 PDT 2026


================
@@ -1130,7 +1132,19 @@ ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
 ImplicitConceptSpecializationDecl::ImplicitConceptSpecializationDecl(
     EmptyShell Empty, unsigned NumTemplateArgs)
     : Decl(ImplicitConceptSpecialization, Empty),
-      NumTemplateArgs(NumTemplateArgs) {}
+      NumTemplateArgs(NumTemplateArgs) {
+  // ASTReader registers a decl before ASTDeclReader visits it, so re-entrant
+  // deserialization can reach this one through a ConceptSpecializationExpr and
+  // call getTemplateArguments() before setTemplateArguments() has run. Give
----------------
zyn0217 wrote:

I'm still very confused: can you explain when and how we reach `getTemplateArguments()` with half-initialized Decl? I guess there might be a bug elsewhere

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


More information about the cfe-commits mailing list