[clang] [clang-format] Fix crash involving array designators (PR #77045)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 9 20:05:15 PST 2024


================
@@ -2315,6 +2315,8 @@ bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
     if (Next->is(tok::greater))
       return false;
   }
+  if (tok::isLiteral(FormatTok->Tok.getKind()))
+    return false;
----------------
XDeme wrote:

With this change this code will crash:
```cpp
Foo foo[] = {
    [0]{1,  1},
    ['a'] { 1, 1 },
    ['a']{1, 1},
};
```

https://github.com/llvm/llvm-project/pull/77045


More information about the cfe-commits mailing list