<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/152266>152266</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-format requires not using requires requires in order to correctly format a function type in a template parameter
        </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>
    Given this input:

```c++
template <typename... Ts>
  requires requires {
 requires std::same_as<int, SomeTemplate<void(Ts&&...)>>;
  }
void Foo();
```

clang-format gets confused and treats the parameter list of the function type like a fold expression over logical and:

```c++
template <typename... Ts>
  requires requires {
 requires std::same_as<int, SomeTemplate<void(Ts && ...)>>;
  }
void Foo();
```

Note that this bug requires `requires requires` to be present to reproduce. Without it clang-format does the right thing (although I think it used to fail in the same way.)

```c++
template <typename... Ts>
 requires std::same_as<int, SomeTemplate<void(Ts&&...)>>
void Foo();
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMlL2O2zgQx5-GagYr0JRF2YUKr_d8uOaaW-DKYCSNJO5SpEKOnPjtA8rGfmSLAEmKAAPYpDhf_x-HGKMZHFEtyntRPmS48OhD_YStbyJmje8u9d_mTA54NBGMmxcWxUHI1bS8WivUfTJ5YJpmi0wgiiNfZnI4UZ7n8BhF8ZeQB4BAnxcTKL7-EVXyfF1H7lKK4hBxok8YRXE0joU6wn9-osdbBlEcz950Qu0eo1BaKJ3nuVD7lCfZGhNE9SDkIR2Ek_dC7dYT92-Lv_bSWnTDXe_DhAwDcYTWu36J1AG6DjgQcgQeCWYMOBFTAGsig-_X3X5xLRvvIHUN1jwTIPTedkBf50Axpm_-nLz8YFq0KeyfpyRcpYRf0vJfzwQ8Il8vTbMMb0rU8kPdQktgDw1BUoocp1WgOfhuaSmH_w2PfmEwDO8wdZ6uSIIZxjWZG0CoHdp0fhjhn3XvOTmuJNlDj8aCcatbUgW-4GVt9ac5_N57-wOBs64uun2xx4zqTVVut1rrfZGNtWyKvkGpi267p01V7UhX3a6UDVZKl1udmVpJVcqd1LIqN0WRV13ZVLuqKXpV9Vg1YitpQmNza89T7sOQmRgXqjelUlpnFhuycX0nlHqLQSiVXo5QJ7-7Zhmi2Mo0GvE1Ehu2VL-D9yKb84lOQvfxQhsHPnQUErnWh0At2wvcIuB3Q2ccILzgehnTbAm2HpnnmOiok1CnwfC4NHnrJ6FOqcjbz90c_BO1LNRp7T0Kdbq1f67VtwAAAP__LIGhTA">