<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54704>54704</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Lambda body indent ignores its signature indent
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
FloopCZ
</td>
</tr>
</table>
<pre>
Hi everyone, I have found an issue with lambda function indentation in expressions containing the pipe `|` operator widely used in `std::ranges` and [range-v3](https://github.com/ericniebler/range-v3) library. The issue is present with both `clang-format-13` and `clang-format-14`.
.clang-format
```
---
DisableFormat: false
Language: Cpp
BasedOnStyle: LLVM
AlignOperands: DontAlign
...
```
`c++` code before `clang-format`
```c++
#include <range/v3/all.hpp>
#include <iostream>
int main()
{
auto this_is_a_beautiful_range_do_you_agree = ranges::views::ints(10, 20)
| ranges::views::transform([](int num) {
int THIS_BODY_IS_OFF = 10;
std::cout << THIS_BODY_IS_OFF;
return THIS_BODY_IS_OFF;
})
| ranges::to_vector;
}
```
`c++` code after `clang-format`
```c++
#include <iostream>
#include <range/v3/all.hpp>
int main() {
auto this_is_a_beautiful_range_do_you_agree = ranges::views::ints(10, 20) |
ranges::views::transform([](int num) {
int THIS_BODY_IS_OFF = 10;
std::cout << THIS_BODY_IS_OFF;
return THIS_BODY_IS_OFF;
}) |
ranges::to_vector;
}
```
It is worth mentioning that removing the `| ranges::to_vector` makes it format the code correctly.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VUtv2zAM_jXORYjhVxrn4EMSL2iBDDl0GLBdDNmmE22yZUhyuvz7UZaTpm3apnsIgm2RoviR-mjmojwkt4zAHuRBNOAES3JHdnQPpBJdUxLaEKZUB-SB6R3htM5LSqquKTQTqGpKaDQdvgn8aiUohStFCoEK1rBmS_QOSMtaIM6N50yX-CSiBUm1kHhsCfxAOgWlOQF1SpdOOMcpabMFZXZTBOJMF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