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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 1 01:40:24 PDT 2026


================
@@ -0,0 +1,26 @@
+// 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.cppm
+export module a;
+
+template<typename... Ts>
+using element = Ts...[0];
+
+export element<int> a = 0;
+
+//--- b.cpp
+import a;
+
+int b() {
+  return a;
+}
+
+// The pack indexing type `element<int>` must be lowered to `i32` without
+// crashing in CodeGen.
----------------
zyn0217 wrote:

Moreover: You should either rename the test file or wrap the test with a namespace pointing to the issue number.

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


More information about the cfe-commits mailing list