[PATCH] D152009: [clang] Fix assertion while parsing an invalid for loop

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 08:29:57 PDT 2023


shafik accepted this revision.
shafik added a comment.
This revision is now accepted and ready to land.

LGTM



================
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}}
----------------
cor3ntin wrote:
> 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?
Yes, I feel like so many bugs could have been fixed by having better coverage that would have caught them when they were committed in the first place.


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