[PATCH] D152009: [clang] Fix assertion while parsing an invalid for loop
Corentin Jabot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 3 02:16:57 PDT 2023
cor3ntin added inline comments.
================
Comment at: clang/lib/Parse/ParseStmt.cpp:2200
Diag(Tok, diag::err_expected_semi_for);
- else
- // Skip until semicolon or rparen, don't consume it.
----------------
shafik wrote:
> Can you explain why you removed this?
The current diagnostics are pretty bad https://godbolt.org/z/z9odv3zjb - this fixes that
================
Comment at: clang/test/Parser/cxx0x-for-range.cpp:67
+ int a[] = {1, 2, 3, 4, 5};
+ for (auto x = n ? 1 : 2 : a); // expected-error {{expected ';' in 'for' statement specifier}} \
+ // expected-error {{expected expression}}
----------------
shafik wrote:
> Did you try dropping the `;` at the end of this line to make sure it still does what we expect?
yup, you think it's worth adding a test?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152009/new/
https://reviews.llvm.org/D152009
More information about the cfe-commits
mailing list