Issue 61469
Summary [clang-format] auto variable initialized with arrow operator can be seen as trailing return type
Labels clang-format
Assignees
Reporter rymiel
    Input code:
```c++
auto a = (b)->c;
```
Result from clang-format-17 (`main`), with default style (`{}`):
```c++
auto a = (b) -> c;
```

The arrow is annotated as a trailing return type arrow due to an imperfect heuristic in `determineTokenType`.

This issue isn't encountered without the (redundant) parentheses:
```c++
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to