<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/71939>71939</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Inconsistent formatting for declaration when using C-style "struct Foo"
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
carlosgalvezp
</td>
</tr>
</table>
<pre>
Consider the following code:
```
struct Foo
{};
int main()
{
struct Foo x{};
Foo y{};
}
```
This leads to inconsistent formatting for `x` and `y` ([example](https://godbolt.org/z/3sz1booPY)):
```
struct Foo {};
int main() {
struct Foo x {};
Foo y{};
}
```
Probably because clang-format things we are redeclaring a struct of type `Foo`, instead of using the C-style syntax for declaring a variable of type `Foo`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyck8GOmzAQhp_GXEaJYCAQHzg0GyH1todeehzwAK4cO7LNbtinr5zNaqO0qlaVkDGM52f-jxkKQU-WuRW7g9gdM1ri7Hw7kDcuTGRe-O2c9U6t7ZOzQSv2EGeG0RnjXrWdYHCKRflN5EeRf6x1fruujyH6ZYjQOXcLNwfRHEV5uM_RNsKJtBW4Fyg_D143AACfKnB5UEjh9H59VG6Ofy3off0x6wCGSQWIDrQdkr8Q2UYYnT9RjMne6DyIOr-IOgeyKu3XtE917g58odPZsNgdBe7nGM8hocBOYDc51TsTt85PArs3gV0Z3oreueefySDKr0KDL_CCO1T3oB5z_4fTs3c99WaFngdaAsNgyE6bd0YQZ22nAK8M5Bk8Kx4M-USOPipxI8T1zAld6oE6F_gE2obIpFJwCel46qqnTYirYQirjXS5sr_XeyGvqTf8p-I2U22pZCkp47aopawR943M5javBmwKHiVXTVFyXSlWauRhaFRNRVVmusUcy6Io8qLEZie3OBb9jqq8lqWUfb4XVc4n0mZrzMsp_c5Mh7Bw2xSylJmhnk24Tg_iPRmBmObJtylt0y9TEFVudIjhUyjqaLj9_o_We7dPUTsLrzPbG6wPUALxbroQs8Wb9qEPdZyXfju4k8Auffl225y9-8VDFNhd_QSB3dXS7wAAAP__xC431Q">