https://github.com/zyn0217 updated https://github.com/llvm/llvm-project/pull/173351
>From c9e3a13c266634e81b303005056867b04ff74f64 Mon Sep 17 00:00:00 2001 From: Younan Zhang <[email protected]> Date: Tue, 23 Dec 2025 17:50:58 +0800 Subject: [PATCH 1/2] [Clang] Serialize expansions of PackIndexingType We have already serialized isFullySubstituted, which hinges on the expansions; if they were lost, we would never expand them correctly from an imported AST. Sadly this bug has been around a year, so there's a release note. --- clang/docs/ReleaseNotes.rst | 1 + clang/include/clang/AST/TypeProperties.td | 5 ++++- clang/test/PCH/pack-indexing-2.cpp | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 clang/test/PCH/pack-indexing-2.cpp diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index feaf92ad4415f..edceaef42394a 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -606,6 +606,7 @@ Bug Fixes to C++ Support - Fix a crash when extracting unavailable member type from alias in template deduction. (#GH165560) - Fix incorrect diagnostics for lambdas with init-captures inside braced initializers. (#GH163498) - Fixed an issue where templates prevented nested anonymous records from checking the deletion of special members. (#GH167217) +- Fixed a serialization bug in PackIndexingType, where we failed to expand those packs from a PCH/module. (#GH172464) - Fixed spurious diagnoses of certain nested lambda expressions. (#GH149121) (#GH156579) - Fix the result of ``__is_pointer_interconvertible_base_of`` when arguments are qualified and passed via template parameters. (#GH135273) diff --git a/clang/include/clang/AST/TypeProperties.td b/clang/include/clang/AST/TypeProperties.td index 03613d53b2776..b150ac2e1cbe3 100644 --- a/clang/include/clang/AST/TypeProperties.td +++ b/clang/include/clang/AST/TypeProperties.td @@ -486,9 +486,12 @@ let Class = PackIndexingType in { def : Property<"isFullySubstituted", Bool> { let Read = [{ node->isFullySubstituted() }]; } + def : Property<"expansions", Array<QualType>> { + let Read = [{ node->getExpansions() }]; + } def : Creator<[{ - return ctx.getPackIndexingType(pattern, indexExpression, isFullySubstituted); + return ctx.getPackIndexingType(pattern, indexExpression, isFullySubstituted, expansions); }]>; } diff --git a/clang/test/PCH/pack-indexing-2.cpp b/clang/test/PCH/pack-indexing-2.cpp new file mode 100644 index 0000000000000..15eb53e7345c5 --- /dev/null +++ b/clang/test/PCH/pack-indexing-2.cpp @@ -0,0 +1,18 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang_cc1 -std=c++2c -x c++-header %t/GH172464.h -emit-pch -o %t/GH172464.pch +// RUN: %clang_cc1 -std=c++2c -x c++ %t/GH172464.cpp -include-pch %t/GH172464.pch + +//--- GH172464.h +template <class... Ts> struct _TypeInfo { + template <int id> using type = Ts...[id]; +}; +using TypeInfo = _TypeInfo<int>; + +TypeInfo::type<0> a; + +//--- GH172464.cpp +int main() { + TypeInfo::type<0> a; +} >From 41a3533da63ae14b23f14ac46c29bff6961ff0b2 Mon Sep 17 00:00:00 2001 From: Younan Zhang <[email protected]> Date: Tue, 23 Dec 2025 18:48:00 +0800 Subject: [PATCH 2/2] Apply feedback Co-authored-by: Corentin Jabot <[email protected]> --- clang/docs/ReleaseNotes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index edceaef42394a..d170a9558ddbd 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -606,7 +606,7 @@ Bug Fixes to C++ Support - Fix a crash when extracting unavailable member type from alias in template deduction. (#GH165560) - Fix incorrect diagnostics for lambdas with init-captures inside braced initializers. (#GH163498) - Fixed an issue where templates prevented nested anonymous records from checking the deletion of special members. (#GH167217) -- Fixed a serialization bug in PackIndexingType, where we failed to expand those packs from a PCH/module. (#GH172464) +- Fixed serialization of pack indexing types, where we failed to expand those packs from a PCH/module. (#GH172464) - Fixed spurious diagnoses of certain nested lambda expressions. (#GH149121) (#GH156579) - Fix the result of ``__is_pointer_interconvertible_base_of`` when arguments are qualified and passed via template parameters. (#GH135273) _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
