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
Result from clang-format-17 (main), with default style ({}):
auto a = (b) -> c;
The arrow is annotated as a trailing return type arrow due to an imperfect heuristic in determineTokenType.
This also applies to decltype(auto):
decltype(auto) a = (b) -> c;
This issue isn't encountered without the (redundant) parentheses:
auto a = b->c;
Originally discovered in https://reviews.llvm.org/D141811; I planned to make a fix for it there, but it turned out harder than I expected, so I'm adding an issue for it so I don't forget.
The text was updated successfully, but these errors were encountered:
The heuristic for determining if an arrow is a trailing return arrow
looks for the auto keyword, along with parentheses. This isn't
sufficient, since it also triggers on variable declarations with an auto
type, and with an arrow operator.
This patch makes sure a function declaration is being parsed, instead of
any other declaration.
Fixesllvm#61469
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D147377
Input code:
auto a = (b)->c;
Result from clang-format-17 (
main
), with default style ({}
):auto a = (b) -> c;
The arrow is annotated as a trailing return type arrow due to an imperfect heuristic in
determineTokenType
.This also applies to
decltype(auto)
:This issue isn't encountered without the (redundant) parentheses:
auto a = b->c;
Originally discovered in https://reviews.llvm.org/D141811; I planned to make a fix for it there, but it turned out harder than I expected, so I'm adding an issue for it so I don't forget.
The text was updated successfully, but these errors were encountered: