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YHiZId_EOkYezUG_ht6iY-G>53405</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bad formatting related to a variadic template and a compound statement
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mordante
</td>
</tr>
</table>
<pre>
I originally encountered a formatting issue in this file using a recent main build of clang-format
https://github.com/llvm/llvm-project/blob/ce368e1aa51f3d9f0a5f6ff0be3c02a9cf1e2d2e/libcxx/test/std/utilities/format/format.functions/vformat.pass.cpp
Using the LLVM formatting style I can reproduce the issue with the following example
```
auto test = []<class... Args>(const Args &... args) {
{
(void) sizeof...(args);
(void) sizeof...(args);
}
};
```
which clang-format turns into
```
auto test_formatted =
[]<class... Args>(const Args &...args){{(void)sizeof...(args);
(void)sizeof...(args);
}
}
;
```
When the lambda doesn't have a variadic template there's no issue
```
auto test_non_variadic = []<class Args>(const Args &args) {
{
(void)sizeof(args);
(void)sizeof(args);
}
};
```
Two other works arounds are
```
auto test_using_if = []<class... Args>(const Args &...args) {
if (1) {
(void)sizeof...(args);
(void)sizeof...(args);
}
};
auto test_using_if_preprocessor = []<class... Args>(const Args &...args) {
#if 0
#endif
{
(void)sizeof...(args);
(void)sizeof...(args);
}
};
```
The expected output should be the same as/similar to the original provided example.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vk1v2zAM_TX2Raghy0kcH3xo1w0osN32cSxkiY61yZIhyUm7Xz_KTrr0Oy02wLBFUSL4Xh7JNFbe1lfEOrVRhmt9S8AIO5oADiThpLWu5yEosyHK-xGIMiR0ypNWaSCjjw5OHAgwgfQcvc2otCS2JUJzszmbAyT0MqHnXQiDT4rzhH3CZ6NCNzaZsD0aWm8Pn7PB2Z8gApqNtg1-BBSrNeScL_O2kFVL-bJdtS1toBCU8Uq0OTDJIAZQjbi5wUUAHyP4IPE9BqVVUOBxvU_osMja0YigrIm-7X5v4N5nYhjmtOf3twlr6IB8_vz9yzExPtwiF1dEcINMYPZyFDCdnCnbIdDJbK3WdhevwA3vBw37-Cu6fyaTj8GSmD5JikuSLC-S5WVSfEA6MaksI-dugyR-TNhaYNZhsknCVtHHo49VJCkv5mDkeIkGW2-tkvGIV7_BtngJ9_bXkuI9R5Pyco8DF4ftB5h2nRLdPUWQMDrjUU7BvszC9Z5plCPycZTfW4g5ZI1c4HOH7CVgJ546Bj8vnqHgRwdmUoHmfSM5kRa8SVgZSMe3gEW05U5xqQSiRm3wMEnIoahLT4ydtfQKVcaa67swj9XzLEOny2bm4lXJvHDsFLl83VliI3qys-6XR1ljS5Lx-xoDU0e6Vu3ba-cJDmIYts4f7D7GeUoRvaeGnsF2PUxdRoD31v0DoAkrECm9M8BI1Z6kg_8F_IEasGjgZsCRgD3AjmEYA_GdHXHMNHOf9bzHCood3Kteae5I5Awdh7lGkK-tknh_33mzOXQqaxwoRcXToIKG-oLL487uINahjNGeqk9u4ojEATZEeeIcwM0eB2E6Ol2_edhNBR4xLIsFXaZdLcu24ixfCLYuV3mzyFleiqIo8lW1lkVZpZo3oH0df33G7o1bxlAPqaoZZYzmbJmXOaVlBlVVskpWlHIqGV0nCwo4tHUWU8ms26SunrJqRvyhFlQrH_xfJ2pLbQxAPestRWl21tW9dZLjP4Z0QlBP6f8B50N4fw">