<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54595>54595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bogus warning -Wunused-but-set-variable
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JohelEGP
</td>
</tr>
</table>
<pre>
See https://godbolt.org/z/P5Kq4osnd.
```C++
#include <limits>
#include <type_traits>
template<auto F> concept constant_invocable = requires { typename std::integral_constant<int, (F(), 0)>; };
constexpr std::numeric_limits<int> int_limits;
static_assert(!constant_invocable<[] { [i = int_limits.min()]() mutable { (void)--i; }(); }>);
```
```
<source>:5:41: warning: variable 'i' set but not used [-Wunused-but-set-variable]
static_assert(!constant_invocable<[] { [i = int_limits.min()]() mutable { (void)--i; }(); }>);
^
1 warning generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVEuPnDAM_jXhEjGCADNw4DDPSu1lpR56HAXwMqlCwuYx2-2vrwPD7Gp3K_VYlGA7jr_4swmN7l7q7wD04txoSbYl7ISj112jpVtp06P1G-dD8e0p11Z1K5IcSLIl62Qee8J2YcyrLBOqlb4DSrK9FINwCHr8zOleRjg7w9_ucDCMkjtAN_dO0xN6aKtVC6ML0jqu3Fmoq255IwPMgRp48sKApWSzowFU8QGodV0gk22FctAbLs9LOGLjGmF7SliJXEvCqmAlQWIi2Q6RDijmlKYw-DWaV0jlBzCiPS_0JjxMFMV97RaNJzrcya0F46az0o80EIEUO1IcJgqoionYK9xqEOqWaHGYFTp4N5cghLDyqkWHy3EsFgLz_oXNcTbe9e5zM9tb7U0LUzW2Bc48xRd95kYJ1Qf1yo2Yj2cbgZNacLTxjirtqLfQBRrxD6-CHqMjxg3xEhVY_Mflof_4kOL22aZLaWgPCgx-wB9uSdTVWVdlFY-ccBLqne69vYf9tVKRN7J-dzWFu_hm1eoBDSmvi4hHo39Ci2U8CWs9WFSKvKiK6FIzztk6rx4rBimkCc_LrIK2yJu8bNdV0USSNyBtHerMmIJnOkGgjhWNRM0SxpKMlWmSsGy9Sh83RZ5D06WbstlkCckTGLiQq5BH-GdEpp5Sanxv0SmFxS7dndhu0SuAem5rhFf9ok39VV9AHr88RNPZ9ZT7HzPBXLI">