<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97240>97240</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] strange formatting for trailing member function call after aggregate initialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jacobsa
</td>
</tr>
</table>
<pre>
clang-format provides strange formatting for an expression that involves a member function call on an rvalue constructed with aggregate initialization. For example:
```c++
return MyStruct{
foo,
bar,
baz,
}
.some_method();
```
The indentation of the trailing method call compared to the initializers and the closing brace is surprising. Compare this with what you get with the parenthesized version, even if you force one line per constructor argument:
```c++
return MyStruct( //
foo, //
bar, //
baz)
.some_method();
```
On that analogy I would expect something more like this:
```c++
return MyStruct{
foo,
bar,
baz,
}
.some_method();
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVEFvqzgQ_jXmMmrkGEjCgcO2UaQ9rPawe18NMIC7xkb2QJv8-idDXtNGrfTUhyzAnz2DZ76PD0PQnSUqRf4o8mOCE_fOl89YuypgUrnmXNYGbffQOj8gw-jdrBsKENij7QhWnLXt4iugBXodPYWgnQXukUHb2ZmZAiAMNFTkoZ1szXG9RmPA2RjlZzQTQe1sYD_VTA28aO4Bu85Th0ygrWaNRl8wxm7g5DzQKw6jIZH-IeRRyJ_3nVxHLdRjHAvqiSdv4a_zP8sHxP6KAwC0zgn1dJtX6G_zCi9vE7E_3nZtghvov4G4d41QB6EKkT7eHeH9uf7tYxUNWV5KANcC9wTsUZvYwDXT2pXaDSN6aoDdsumtevIB0DYLWBsXYmDlsSbQAcLkR68jtoGnNQNwr8Pay5dIx9lN0BGvSEwSN1nuKegLNTCTj9QJ9QQ0kwXdLhGt8zWBswRGW4KR_I2qSLvvpoEsf4sIdQAQ6hTHW2uv18oLfLm-8nS_vhBWfJ-nv6_KRYvGdWf4E17cZJqobKoZYjbuF8Kcjw35f23y76nwXoIfKvwEvtzDN2n-Sr1JU6ZNkRaYULndb4v94ZDKNOnLXOWyLlqZbmmndphlslKSKKedbNM82yW6VFJlcpdKpfKDSjeqyZvttkj3VZ7tZdGITNKA2myMmYeN812iQ5ioLPYqk4nBikxYDEep994ilIoW5MsY9lBNXRCZNDpwuCVizWYxqw-B-fErO3r3a33iPNgy-S8dJpm8KXvmcSF20VenuZ-qTe0GoU7xUNfHw-jdM0Upn5ZSg1Cntdq5VD8CAAD__17lp8Y">