<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/148436>148436</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-format won't accept the space after let for structured binding declarations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
anordal
</td>
</tr>
</table>
<pre>
Just like nobody would remove the space after `const auto`, even when it is possible,
clang-format shouldn't do so just because I define a macro for it.
Clang-format wants to do this:
```diff
// clang-format --style='{IndentWidth: 4, AllowShortFunctionsOnASingleLine: false, ColumnLimit: 0}' letdemo.cpp
#define let const auto
struct Point2D {
int x;
int y;
};
#define let const auto
void demonstrate_basecase() {
const auto [x, y] = Point2D{};
}
void demonstrate_let() {
- let [x, y] = Point2D{};
+ let[x, y] = Point2D{};
}
```
clang-format --version
> clang-format version 20.1.7
Possibly related to #22392.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVF2vozYQ_TXDyygIDISbBx6Sm0baaqWutA99rPwxBG-NHdlD7ubfV05o702rSrtRJPB4POccOAeZkj17ogG6A3THQi48hThIH6KRrlDB3IZfl8To7J-EPuQCvoXFGYw0hyshT4TpIjWhHJkiwrbSwSdGuXCAbQXiFelKHt8m8mgZbcJLSMkqRyBeodprJ_15M4Y4S8Y05eEeRM9oAqaA3zK8Ii2XRPgJDY3WE0qcpY4BxxDRcgnVHqr968dJb9JzQg55DE82QbN_dGVS97-x4wjVHkGcQJzwicdmk_jmCJojiB76wydvyPPv1vAEzR7bLGvvXHj7OoXIp8VrtsGn3_z-q_VnR5-tp9w4SpeyTnwNbpn9ZztbzvUK-jwZHbGhOZT6crlTudNpVpGOGD88zHU_cVw045dgPYsjQn_I1fyznvE7NE_r27rOeOvdD2BcgzWYifnEUTL9oWQiLbOUFxC7j6DvhxG6w_es9QbdEaE5_s0xd7_D98f_RXHETwCbDJAZ_shkEIe1_Sd4_GOGhzf-5YErxWSDX33T_PLskXUXRVXWZf9o-vKw9g0jOclksgFBNEI0O1EWZmjMrtnJgoa670Rb97u-LaahNbrvm06p-mWrqkq1arfdtuMoZN01ysjCDqISXdXXTd2227otldoJozpqRUd62xO0Fc3SutK561yGeC5sSgsNdfvSNtvCSUUu3VMuxEcRIETOfRzyuY1azgnaytnE6X0SW3Y0PIcrPCIqtaYL_-cjkF9ZTubDqkskg8p6Y_0ZDWkno7ynpViiGybmyz2c9xSeLU-LKnWYQZwyg_WyucTwjTSDON2FJRCnVdt1EH8FAAD__y4ueos">