Author: Younan Zhang Date: 2025-12-23T18:48:30+08:00 New Revision: 64c40590c02429ee9dba422f9a58b45fa713f401
URL: https://github.com/llvm/llvm-project/commit/64c40590c02429ee9dba422f9a58b45fa713f401 DIFF: https://github.com/llvm/llvm-project/commit/64c40590c02429ee9dba422f9a58b45fa713f401.diff LOG: [Clang] Serialize expansions of PackIndexingType (#173351) 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. Fixes #172464 Added: clang/test/PCH/pack-indexing-2.cpp Modified: clang/docs/ReleaseNotes.rst clang/include/clang/AST/TypeProperties.td Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 33d0520d15b38..2319ff13f7864 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -618,6 +618,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 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) - Fixed a crash when evaluating nested requirements in requires-expressions that reference invented parameters. (#GH166325) 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; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
