<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65904>65904</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] incorrect formatting with `&` qualifier and requires clause with multi-arg template
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
danakj
</td>
</tr>
</table>
<pre>
The first one has no `&` qualifier and is formatted correct.
The second one adds `&` and clang-format gets confused, I don't think it's aware this is a function anymore.
```cpp
struct S {
template <class... Args>
constexpr void f()
requires(true && C<true, Args...>)
{
return;
}
template <class... Args>
constexpr void f() & requires(true && C<true, Args...>) { return; }
};
```
The `const` and `const&` qualifiers are parsed correctly. `&&` is also incorrect.
```cpp
struct S {
template <class... Args>
constexpr void f() const
requires(true && C<true, Args...>)
{
return;
}
template <class... Args>
constexpr void f() const&
requires(true && C<true, Args...>)
{
return;
}
template <class... Args>
constexpr void f() && requires(true && C<true, Args...>) { return; }
};
```
https://godbolt.org/z/qKTWec96e
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlE9v2zAMxT8NfSFiKHJsxwcf2mQBhh1XYGdFkm21ipSKcrvu0w-Kmz8r1qLbsGFBkMAM_fKj3jMFkemd1i2U11CuMzHGwYdWCSfubrOtV0_tzaCxM4EieqdxEITOI1QMeAUVw_tRWNMZHVA4hYaw82EnYtQKpQ9By5gDWwO7mj6TGmnpnTrICaXoQixJSCtcP5tUsNeRUHrXjaQV8BV-ROUd8DpiHIy7QxOB14TiUQSdSpQQBHajk9F4h8I97XzQR4aKTW-5308VimGUET8j1NdTBREx6t3eiqgRipW0gijPc7wKPUHx4dwlvaOov-4DPnijsAO-BN6cf0-voO9HEzQBX8YwakyD8gpXUKzSdRop6eZ5nqQv7_4BaJKKY3BQXF_2rC8P9_3or-Mnwl-mTrBnvgusen3iPZ39yzgkOxLKMQCn6xcBI0we70Wgc7bsU36Mz9Sd3Lfk0bifpe9d_v-J-VP5uesvev_bxr-Jzav_mPztyP7T1A4x7gmKK-Ab4Jveq623MfehB775Bnxz_-nmi5ZNpTPVFqopGpHpdl41i6KqqqrIhpbJqmNqviyX9XIuWKNlKXnT1V0h2ZzLOjMtZ7xgzZzNa77gRV7yQqtuWS7qrl6qmsOC6Z0wNrf2YZf-OzNEo26rsmGLzIqttnTc6qFNTbPt2BMsmDUU6XxbNNEe9v_l4oVyfX6EjivduB4fTRxe3f5HA9IOH0lPzbvRRjMToT_5nI3Bti_O0MRh3ObS74BvEtrz12wf_K2WEfjmMB4B3xwm_B4AAP__5kjwxw">