-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Clang][Sema] Avoid pack expansion for expanded empty PackIndexingExprs #92385
Changes from 2 commits
7acbb1d
afa1de4
e95fe54
56a62cf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2157,11 +2157,11 @@ void ASTStmtWriter::VisitSizeOfPackExpr(SizeOfPackExpr *E) { | |
void ASTStmtWriter::VisitPackIndexingExpr(PackIndexingExpr *E) { | ||
VisitExpr(E); | ||
Record.push_back(E->TransformedExpressions); | ||
Record.push_back(E->EmptyPack); | ||
Record.AddSourceLocation(E->getEllipsisLoc()); | ||
Record.AddSourceLocation(E->getRSquareLoc()); | ||
Record.AddStmt(E->getPackIdExpression()); | ||
Record.AddStmt(E->getIndexExpr()); | ||
Record.push_back(E->TransformedExpressions); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This appears to be a copy-paste error of line 2160... So I removed it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird that this did not cause any issues... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think that's just because we didn't test it (nor does anyone... use it at scale). Anyhow, I contrived an example that would previously crash in template <int I, auto...V>
decltype(V...[I]) foo() { return V...[I]; }
void fn1() {
foo<1, 2, 3, 4>();
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (And I didn't receive any notification from GH for this comment... sorry, I just saw it.) |
||
for (Expr *Sub : E->getExpressions()) | ||
Record.AddStmt(Sub); | ||
Code = serialization::EXPR_PACK_INDEXING; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to
unsigned
becausenumTrailingObjects
is designed to return anunsigned
number.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: I'm not spelling it as
: sizeof(unsigned) - 1
because we seem to write down the number 31 directly elsewhere. So I think i'd better respect the convention.