Skip to content

Commit

Permalink
[Clang] Resolved type of expression indexing into pack of values of a…
Browse files Browse the repository at this point in the history
… non-dependent type (llvm#121405)
  • Loading branch information
TilakChad authored Jan 1, 2025
1 parent a29bd8c commit 1623c43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
16 changes: 16 additions & 0 deletions clang/test/SemaCXX/cxx2c-pack-indexing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1623c43

Please sign in to comment.