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

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


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

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

Fixes https://github.com/llvm/llvm-project/issues/204479

>From e4e0af6e75a56918530aaf31c6024de7cdb1c09a Mon Sep 17 00:00:00 2001
From: LeeYoungJoon <dog3hk.dev at gmail.com>
Date: Fri, 26 Jun 2026 12:39:01 +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