<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/75790>75790</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format over-indents function after requires clause missing parentheses
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zmodem
</td>
</tr>
</table>
<pre>
Consider:
```
$ cat /tmp/a.cc
template <typename T> inline constexpr bool B = false;
template <typename T>
requires !B<T>
void g(T t) {}
$ build/bin/clang-format /tmp/a.cc
template <typename T> inline constexpr bool B = false;
template <typename T>
requires !B<T>
void g(T t) {}
```
Note the over-indent of `void g(...`.
It seems that parentheses are required to make the code valid:
```
$ build/bin/clang -c -std=c++20 /tmp/a.cc
/tmp/a.cc:3:10: error: parentheses are required around this expression in a requires clause
3 | requires !B<T>
| ^~~~~
| ( )
1 error generated.
```
With the added parentheses, clang-format will do the right thing. If possible, it would be helpful it it handled the original code more gracefully, though.
(Originally from https://crbug.com/1511363)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVM2O4ygQfprypRQLQ-zEBx86yUSay-5lpD1jU7bZxeCFcs_2HvrZV066p5PRdPdxkQUyRRV8P6BTsoMnaqA8QHnK9MJjiM2_UzA0ZW0wT80x-GQNRVAPIE4gXvtKvHzXX7nFTjOCPPM0gzzrvOuuIaZpdpoJQR35aSavJ8JvoL6g9c56wi74xPTPHLENweEBQZ2w1y4RqMMnNa7hSH8vNlJCkMUB1PEt8hiswQHk_hsyyBphd4Dd6Q6I3GK7WGdAnlvrQZ47p_2w6UOc_jdAiO9Dwg8x_STLpf8tMCGPhOGR4sZ6Q54x9AiV-FErz3OoRH6b9pUxEU0JedSMs47keaRECXWk1wMa5ICT_uu6QRcM4aN21nxul1-QjpsON4kNqFMH8gDyIMWvFLifUg8K1EMhQD0gxRhWq75_XB3D4g3yaBOuGlFKNni0HvUb6Z3TS6JXLRAVwu74kSaXtq750aD88vz8_Px-XO6vQ31dUlzPjgN5iprJ5B8o-ofl8UK4NobMLViQR7wz8HfrHJpwWR3tMPIK3Q85fu1xDinZ1tGaZBm_h8UZbAlHcnO_uHXOMo7aG7cKvToo2sF67a5KTyESDlF31C_OPa1leAzLMOb3N2z_-0uae8I-hglH5jmtFpHnVfvYLkPehQnkuSiLQlUKZJ2ZRpla1TqjptgJWQtVqCobG-pN1Za12eqS2lpUsuhkK3RfFWJLotxntpFCqkIW-0KqfVnlWzJFr_uioKoQSgnYCpq0dblzj1Me4pDZlBZqduWuFpnTLbl0eRKlvOUSpFwfydisaZt2GRJshbOJ01shtuyouVPg5tYl7Bff8Wo43TPFnx2Hk03J-uFW0WyJrrknbLA8Lu0LY-vWL8NmjuFP6hjk-QIogTxfMP0XAAD__28Cy98">