[PATCH] D113826: [clang-format][c++2b] support removal of the space between auto and {} in P0849R8

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 13 07:12:18 PST 2021


Quuxplusone requested changes to this revision.
Quuxplusone added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/unittests/Format/FormatTest.cpp:22574
+  verifyFormat("foo(auto{{}})");
+}
+
----------------
Looks like a good improvement to me!
However, note that `auto()`, `auto{}`, `auto({})`, `auto{{}}` are all invalid expressions; and it would be good to test with something inside the braces anyway. Please replace with e.g.
```
verifyFormat("foo(auto(1))");
verifyFormat("foo(auto{1})");
verifyFormat("foo(new auto(1))");
verifyFormat("foo(new auto{1})");
verifyFormat("decltype(auto(1)) x;");
verifyFormat("decltype(auto{1}) x;");
verifyFormat("auto(x);");
verifyFormat("auto{x};");
verifyFormat("auto{x} = y;");
verifyFormat("auto(x) = y;");  // actually a declaration, but this is clearly the user's own fault
verifyFormat("integral auto(x) = y;");  // actually a declaration, but this is clearly the user's own fault
verifyFormat("auto(*p)() = f;");  // actually a declaration; TODO FIXME
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113826



More information about the cfe-commits mailing list