<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/149041>149041</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Clang] -Winvalid-constexpr misbehaves in C++23 mode
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
regression,
rejects-valid,
constexpr
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
frederick-vs-ja
</td>
</tr>
</table>
<pre>
In C++23/26 mode, Clang rejects the following function definition with `-Winvalid-constexpr` used, saying "constexpr function never produces a constant expression". [Godbolt link](https://godbolt.org/z/WaKPMjorP).
```C++
constexpr bool fun(const bool& b) { return b; }
```
This seems related to [P2280R4](https://wg21.link/p2280r4), but the incorrect diagnostic occurs only since Clang 21.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU11r5DgQ_DXtl2aM3P4aP_hhPvBxHAfhOMizbLVtJRppkOTJZn_9Ymc2E5aAwaLUVJeqq2UIerLMLZRHKM-JXOLsfDt6Vuz18Lq7hd2LTHqn3tu_LZ6AjkBHyoE6qvDiFAOd8GSkndDzCw8xYJwZR2eMe9N2wnGxQ9TOouJRW70d33ScESqxe9b2Jo1Wu8HZEPnH1UMlcAmsVtog31cGIPq8ftBZvrHHq3dqGTigxK1G2ohrHYegnQWiFKE8_uVU70xEo-0rlGeg_RzjNUB-AOqAuunjPnV-Aup-AnXP8p-nf1-cfwJqUhAHqMTHd3cAxOGhqXfOrMKA9hu4AUAV9kANQn1Ez3HxFnvIjwj1-SvhehaH_2cdMDBfAno2MrLC6FbpT0R78V_xneq3ibJ0exJ117XMF0DNaly_xG0K2g7Oex4iKi0n60LUA7phWHxAZ807Bm0Hvo-PsjRRba6avJEJt1ldUlXWWS6SuW1UU8ps5JGlkNW4z2rZFxWPY12ONYs80S0JKkWdVaLJKBOpqMp9nde93JfZqEYFheCL1CY15nZZjU50CAu3WdGIIkuM7NmELYVEw6oH8sPonY1sFRABnYDI8_SY7G9oC91ui9En-ogT0Rpr365td_0yBSiE0SGGh5Coo9kWYPMByjN-k0u86NDzLG8cUH9ZhG0HksWb9o9I6TgvfTq4C1C3trr_dlfvVsVA3WZAAOruHtxa-hUAAP__DTghQg">