[PATCH] D131978: [clang-format] Concepts: allow identifiers after negation

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 17 12:57:38 PDT 2022


HazardyKnusperkeks added a comment.

In D131978#3729644 <https://reviews.llvm.org/D131978#3729644>, @rymiel wrote:

> It seems that even with this patch, there is seemingly weird formatting with the negation in requires clauses, such as:
>
>   template <typename T>
>     requires !F<T>
>              int bar(T t);
>
> This is because the "fake parens" of the unary expression opened is never closed by the special case clean-up made for requires clauses
> However, it turns out this isn't even valid syntax, as it requires parentheses for disambiguation. Adding those brings back correct indentation
>
>   template <typename T>
>     requires(!F<T>)
>   int bar(T t);
>
> Is it okay to ignore this case, as it wouldn't even compile?

Yeah it is okay when invalid code is not formatted "nicely". It wouldn't hurt if we do, but the time can be invested better.

We'll give the others some time to react, I will (most likely) push the commit on the weekend.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131978



More information about the cfe-commits mailing list