<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57308>57308</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format line breaks second and third argument to the ternary operator differently
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zmodem
</td>
</tr>
</table>
<pre>
Consider:
```
$ clang-format /tmp/a.cc
void F() {
while (true) {
if (!(address_size == 4 ? sequential_reader->Read(
size,
[this](const void *data, size_t size) {
return ReadTuples<uint32_t>(data, size);
})
: sequential_reader->Read(
size, [this](const void *data, size_t size) {
return ReadTuples<uint64_t>(data, size);
}))) {
return;
}
}
}
```
Note how both sides of the `:` are identical except for uint32_t vs uint64_t, but one gets formatted as
```
size,
[this](const void *data, size_t size) {
```
and the other as
```
size, [this](const void *data, size_t size) {
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzFVEtv2zAM_jXyhWhgy88cfGib5bjDsHsgW4ytTbYyiW7X_vrRTp_B0OYQbIIgUxb5kR8pqnH6ob51YzAavUivRbwR8fNaxE_zuJUZtFaN3dXe-UERCLml4cCrWrXtUefOGQ1bISsh1yDKm-NfgPveWGSDivyEJ2cAZg-LScKr0tpjCLtgHtkg3fCEjIUtBPw14UhG2Z1HxeFeifTLN5Zm2xesj8eMKuTtueoiv6HeBJFv2EfLWSJYGAp5rRUpRloQd_QEfMLrs-GRJj_CzOH7dLAYRHo7mZFSuSPmxj7femF4kZ6NLsrNbPCpNtf8kpn9XykrsoulbJmnUR39vgOb1Z82L-KrcNI7y_rVEULv7qFx1MPccgHcHqjnm86a6WwFyiPwCZejVRbwd4sHAu44eL4ZcBfghTITbSYCNyJ0SAGOrUmoQYUPevnsev6DTvlrqtSol7xwotBfiMtFgoywTooikUWxjvNI16lep2sVkSGL9bvn0RouSsMN9TNwh7E7rsnCyniWfDcNXGQgt_Ak9KPyD-AO6BVxtbXZ79Gzhn2IJm_rnugQ5isi-Xnddob6qVm1buCNtXfPn6uDdz-w5XuxNSFM3B5ym5dpXEV9rdpqnVRJkhWJbuMykTLLKp3rUhaqTPdJZFWDNtScJSHlWyq85ZxFppaxlHEl0ySPkyxfNVlcVPtCyWxdxmmMIotxUMau5lBWzneRr5eomqkLfGhNoPB6qEIw3Yi4eGR8NVHvfP04OI1DtMRfL8H_AfcPxBo">