[clang] [clang][serialization] Fix crash on imported pack indexing type (PR #205964)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 25 20:31:43 PDT 2026


https://github.com/IamYJLee created https://github.com/llvm/llvm-project/pull/205964

The selected index of a PackIndexingType was not serialized, so on deserialization its canonical type was rebuilt as a dependent type, crashing CodeGen.

Fixes #204479


>From d8316f5f8ae6d09c500f3b7a29cc68a21bc0d749 Mon Sep 17 00:00:00 2001
From: YoungJun Lee <yjlee at nshc.net>
Date: Fri, 26 Jun 2026 12:28:55 +0900
Subject: [PATCH] [clang][ast] Add an index property for PackIndexingType
 serialization

---
 clang/include/clang/AST/TypeProperties.td | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td
index f16c10da430f9..e2168d0a00ff4 100644
--- a/clang/include/clang/AST/TypeProperties.td
+++ b/clang/include/clang/AST/TypeProperties.td
@@ -489,9 +489,12 @@ let Class = PackIndexingType in {
   def : Property<"expansions", Array<QualType>> {
     let Read = [{ node->getExpansions() }];
   }
+  def : Property<"index", UnsignedOrNone> {
+    let Read = [{ node->getSelectedIndex() }];
+  }
 
   def : Creator<[{
-    return ctx.getPackIndexingType(pattern, indexExpression, isFullySubstituted, expansions);
+    return ctx.getPackIndexingType(pattern, indexExpression, isFullySubstituted, expansions, index);
   }]>;
 }
 



More information about the cfe-commits mailing list