You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lambdas without parameter lists seems to be formatted correctly, though that's not surprising as that was a valid position for attributes before C++23.
Maybe, but if you replace the macros in the example with __attribute__((whatever)), it formats as expected.
e: I might have been unclear; this is specifically in regards to macros. The example is also formatted correctly if you replace the macros with [[...]]
mattco98
changed the title
[clang-format] Invalid formatting of attribute applied to lambda call operator with arguments
[clang-format] Invalid formatting of attribute applied through macro to lambda call operator with arguments
May 18, 2024
clang-format works on a lexer level. It doesn't do preprocessing. It does not know about macros. If you put a -> after the __attribute__ (as in the other issue), that doesn't get formatted either. I'm guessing that it looks like the attribute works because it treats that as the name of the lambda and then parens of the attribute as the parameter list.
I'm guessing that this needs a call to handleAttributes() (or similar) somewhere in tryToParseLambda() when it's done parsing the capture.
I would expect the following code to be untouched:
However, the file gets formatted as:
Lambdas without parameter lists seems to be formatted correctly, though that's not surprising as that was a valid position for attributes before C++23.
Tested on the latest commit (e90126e)
The text was updated successfully, but these errors were encountered: