[PATCH] D133248: [clang] Fix crash upon stray coloncolon token in C2x mode

YingChi Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 22:43:03 PDT 2022


inclyc added inline comments.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:5340
+    if (!getLangOpts().CPlusPlus)
+      return false;
     if (NextToken().is(tok::kw_new) ||    // ::new
----------------
Maybe we can make a new `error` diagnostic definition and fire that here?


================
Comment at: clang/test/Parser/c2x-attributes.c:146
+// Ensure that '::' outside of attributes does not crash and is not treated as scope
+double n::v; // expected-error {{expected ';' after top level declarator}}
----------------
Could we improve this diagnostic message? 
```
expected ';' after top level declarator}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133248/new/

https://reviews.llvm.org/D133248



More information about the cfe-commits mailing list