Skip to content

Commit 1623c43

Browse files
authored
[Clang] Resolved type of expression indexing into pack of values of a non-dependent type (#121405)
1 parent a29bd8c commit 1623c43

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ Bug Fixes to C++ Support
886886
out of a module (which is the case e.g. in MSVC's implementation of ``std`` module). (#GH118218)
887887
- Fixed a pack expansion issue in checking unexpanded parameter sizes. (#GH17042)
888888
- Fixed a bug where captured structured bindings were modifiable inside non-mutable lambda (#GH95081)
889+
- Fixed an issue while resolving type of expression indexing into a pack of values of non-dependent type (#GH121242)
889890

890891
Bug Fixes to AST Handling
891892
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ExprCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,7 @@ PackIndexingExpr *PackIndexingExpr::Create(
17221722
if (Index && FullySubstituted && !SubstitutedExprs.empty())
17231723
Type = SubstitutedExprs[*Index]->getType();
17241724
else
1725-
Type = Context.DependentTy;
1725+
Type = PackIdExpr->getType();
17261726

17271727
void *Storage =
17281728
Context.Allocate(totalSizeToAlloc<Expr *>(SubstitutedExprs.size()));

clang/test/SemaCXX/cxx2c-pack-indexing.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,19 @@ template <class... Args> struct mdispatch_ {
305305
mdispatch_<int, int> d;
306306

307307
} // namespace GH116105
308+
309+
namespace GH121242 {
310+
// Non-dependent type pack access
311+
template <int...x>
312+
int y = x...[0];
313+
314+
struct X {};
315+
316+
template <X...x>
317+
X z = x...[0];
318+
319+
void foo() {
320+
(void)y<0>;
321+
(void)z<X{}>;
322+
}
323+
} // namespace GH121242

0 commit comments

Comments
 (0)