<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56350>56350</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Short lambda with brace initialiser being split by clang-format, even with AllowShortLambdasOnASingleLine
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
a7g4
</td>
</tr>
</table>
<pre>
It seems like `clang-format` is doing something strange if a lambda uses brace initialiser in its body.
Using this config:
```
AlignAfterOpenBracket: Align
AllowShortBlocksOnASingleLine: Always
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
```
This code:
```
int main() {
SomeType something1(
[](const Input& i) -> Output { return Output {1, 2}; },
[](const Input& i) -> Output { return Output {1, 2}; }
);
SomeType something2(
[](const Input& i) -> Output { return Output (1, 2); },
[](const Input& i) -> Output { return Output (1, 2); }
);
}
```
Gets formatted into this:
```
int main() {
SomeType something1(
[](const Input &i) -> Output {
return Output{1, 2};
},
[](const Input &i) -> Output {
return Output{1, 2};
});
SomeType something2([](const Input &i) -> Output { return Output(1, 2); },
[](const Input &i) -> Output { return Output(1, 2); });
}
```
My expectation is that it should become:
```
int main() {
SomeType something1([](const Input &i) -> Output { return Output{1, 2}; },
[](const Input &i) -> Output { return Output{1, 2}; });
SomeType something2([](const Input &i) -> Output { return Output(1, 2); },
[](const Input &i) -> Output { return Output(1, 2); });
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVs1ymzAQfhpx2YlHCAP2gYOdNJ3MpJND0gcQsIAaWTBIxPXbd4E4iR2SJh23p2oYkHZXu_stn37SOt8lVw4s4saCVvcILOKZlqY8K-p2Ix0NQVnIa2VKsPUGXTX0XEs2CKoACVpu0lxCZ9FC2sqMxEY5JbWy2FIflCMFhZoxfsH4anx_t70jcmchq02hShY8aijm4zMMV1qVZlU4bG8aNGsKcI-OjGFQ7G10vb2t6tatdZ3d2xuzuiX3Gq-VwdF2K3f22PiyM5lTtZmy18fG1wPMd0yP8h7fdyPAHN-Cp4yDjVSGiQUTS2DxepQDtVsq-N2uwefK-73Zk75vLFyz8ILEVEXr4Mo0nWMiAtV7O2PBF7jpHMl6z9Ci61rzQkL-zkGw-IIFa-g_4vyvun_yTdNJ9rJS04DFSQGLxWNGQ_STA55wPw14r5ikzFek9TIuP4c5LSBXD-vk8wz6PX-m0FKq0RTawzodQD_61QcRXtX4H8V8za832PWJdI4y-ACdDtuJY32UUd92gD8bzJzsd7t-Q3eVdLQvg63qTueQYkYleSbYSWj251g_sC-drK5Tsf5Th4ZengT5MlhKzymnMRkOwf1hv1WumjjsUxxuB40maqU7OLhJUAb4gGac-v6x6nWtTirnmmHPE5f0lDSrS2dEUxpo_bD_nDVt_YOYTUNlbYeWOmEUhNyrkmWQoY9xXvBFJEU4z4N5HEfzBc-jRcF57mmZorZJX1ohDG5hcEF9qrSnEsGF4DEXfOnHoZj5hR_iUmb-gsepH0VszpEWhJ71eczqtvTaZEgp7UpLSiqJs89KaS3dVxCT8U96snOEP5FxOfeGuMmQ9y-G2bDt">