[clang] [clang][serialization] Fix crash on imported pack indexing type (PR #205965)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 02:43:10 PDT 2026
================
@@ -0,0 +1,31 @@
+// RUN: rm -rf %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++26 -triple %itanium_abi_triple -emit-module-interface %t/a.cppm -o %t/a.pcm
+// RUN: %clang_cc1 -std=c++26 -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - %t/b.cpp | FileCheck %s
+
+// A fully-substituted pack indexing type (`Ts...[0]`) exported through a module
+// used to lose its selected index on deserialization, so its canonical type was
+// rebuilt as a dependent PackIndexingType. CodeGen then hit
+// llvm_unreachable("Non-canonical or dependent types aren't possible.").
----------------
zyn0217 wrote:
This doesn't really need to be a module test, right? I wonder if we can reproduce the bug with simple PCH import/export.
Besides, you need to teach your AI to wrap the test with the github issue number, and let it not write any unnecessary briefs. Thanks
```suggestion
// RUN: rm -rf %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++26 -triple %itanium_abi_triple -emit-module-interface %t/a.cppm -o %t/a.pcm
// RUN: %clang_cc1 -std=c++26 -triple %itanium_abi_triple -fmodule-file=a=%t/a.pcm -emit-llvm -o - %t/b.cpp | FileCheck %s
```
https://github.com/llvm/llvm-project/pull/205965
More information about the cfe-commits
mailing list