Author: TilakChad Date: 2025-01-01T15:50:05+08:00 New Revision: 1623c435948ae305220e638066e968cb3296e567
URL: https://github.com/llvm/llvm-project/commit/1623c435948ae305220e638066e968cb3296e567 DIFF: https://github.com/llvm/llvm-project/commit/1623c435948ae305220e638066e968cb3296e567.diff LOG: [Clang] Resolved type of expression indexing into pack of values of a non-dependent type (#121405) Added: Modified: clang/docs/ReleaseNotes.rst clang/lib/AST/ExprCXX.cpp clang/test/SemaCXX/cxx2c-pack-indexing.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index b7da12bcf65818..2a688a677294f8 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -886,6 +886,7 @@ Bug Fixes to C++ Support out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218) - Fixed a pack expansion issue in checking unexpanded parameter sizes. (#GH17042) - Fixed a bug where captured structured bindings were modifiable inside non-mutable lambda (#GH95081) +- Fixed an issue while resolving type of expression indexing into a pack of values of non-dependent type (#GH121242) Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index fc09d24fc30cb4..5bf5d6adf525a8 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -1722,7 +1722,7 @@ PackIndexingExpr *PackIndexingExpr::Create( if (Index && FullySubstituted && !SubstitutedExprs.empty()) Type = SubstitutedExprs[*Index]->getType(); else - Type = Context.DependentTy; + Type = PackIdExpr->getType(); void *Storage = Context.Allocate(totalSizeToAlloc<Expr *>(SubstitutedExprs.size())); diff --git a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp index cb679a6c3ad879..58b642d2735b6e 100644 --- a/clang/test/SemaCXX/cxx2c-pack-indexing.cpp +++ b/clang/test/SemaCXX/cxx2c-pack-indexing.cpp @@ -305,3 +305,19 @@ template <class... Args> struct mdispatch_ { mdispatch_<int, int> d; } // namespace GH116105 + +namespace GH121242 { + // Non-dependent type pack access + template <int...x> + int y = x...[0]; + + struct X {}; + + template <X...x> + X z = x...[0]; + + void foo() { + (void)y<0>; + (void)z<X{}>; + } +} // namespace GH121242 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits