Skip to content

Commit 7ea2b4c

Browse files
committed
[Clang] Recurse into parsing when using pack-indexing as a specifier
1 parent 814ed93 commit 7ea2b4c

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ Bug Fixes to C++ Support
763763
- Fixed a bug where bounds of partially expanded pack indexing expressions were checked too early. (#GH116105)
764764
- Fixed an assertion failure caused by using ``consteval`` in condition in consumed analyses. (#GH117385)
765765
- Fix a crash caused by incorrect argument position in merging deduced template arguments. (#GH113659)
766+
- Fixed a parser crash when using pack indexing as a nested name specifier. (#GH119072)
766767
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
767768

768769
Bug Fixes to AST Handling

clang/lib/Parse/ParseExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind,
11991199
// If the token is not annotated, then it might be an expression pack
12001200
// indexing
12011201
if (!TryAnnotateTypeOrScopeToken() &&
1202-
Tok.is(tok::annot_pack_indexing_type))
1202+
Tok.isOneOf(tok::annot_pack_indexing_type, tok::annot_cxxscope))
12031203
return ParseCastExpression(ParseKind, isAddressOfOperand, isTypeCast,
12041204
isVectorLiteral, NotPrimaryExpression);
12051205
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,12 @@ struct SS {
7474
}
7575
};
7676
}
77+
78+
namespace GH119072 {
79+
80+
template<typename... Ts>
81+
void foo() {
82+
decltype(Ts...[0]::t) value;
83+
}
84+
85+
}

0 commit comments

Comments
 (0)