[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 13:30:43 PST 2021


Quuxplusone added a comment.

In D113826#3129383 <https://reviews.llvm.org/D113826#3129383>, @lichray wrote:

>   void f() {
>     T { &a } -> n = 1;
>   }
>
> and
>
>   void h() {
>     auto{ &a } -> n = 0;
>   }
>
> But this may not worth a fix (for now).

Kibitzing: I don't think those cases matter to real code. But that spacing is //so bizarre// that it might be worth looking into anyway. Like, what does clang-format think `auto{&n}` even //is?// I can't think of any construct at all in C++ where we'd want to format it as `T { anything` or `auto{ anything`. I wonder if this means clang-format would misformat `T{1, 2}` as `T { 1, 2 }`! Basically the only reason to leave a space in the middle of `identifier {` is if you're concerned about cutesy macros like `IF_CONSTEVAL {`, but in those cases you should be looking for there to be a newline after the `{` anyway.


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

https://reviews.llvm.org/D113826



More information about the cfe-commits mailing list