<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69554>69554</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
<algorithm>: `__is_callable` checks whether the callable can be called with rvalue
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hewillk
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/blob/a574242f196dd0afaa2c591d6cc5716fd67bc738/libcxx/include/__type_traits/is_callable.h#L22-L29
Some std algorithms check whether callable is an ordinary function through `__is_callable`. However, according to its above definition, this seems to only check whether callable can be called with an rvalue, which seems to be an oversight.
```cpp
#include <algorithm>
struct Cmp {
bool operator()(int, int) const &;
bool operator()(int, int) && = delete;
};
int main() {
return std::minmax({42, 0, -42}, Cmp{}).first;
}
```
https://godbolt.org/z/8a45rPdqo
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMuO5CYU_Rq8QV1yXWxcXnjRj1hZzCJSPqCE4bogg6EC11Xd-foI13R3zSiJMpIF5nHOffgcq5zdKSAOrH1i7UulVrIxDRavzvuv1RTN22CJzpmJRwYjg_HkyK7TTseFwej95X16OKf4B2piME4-TgxG1XYNNDDve2lMrWalQLf93kit224vZyO7SXfiUAjcpF9fGYwuaL8aZDAej_R2xiMl5SiXk3zUyns1edxZBuILwMMX6Fn9wurH2_h7XJBnMlz5U0yO7JK5tqi_8qtFspj4OwN3mavAYzIuqPTG5zVocjFwsimuJ8uZrI_Hu5BM1jv-a7ziBRODZ6603sAnTpE7ylxN8YLc4OyCK0zlElmXeUZccrkVg3_7t3S0CnzCbY2GXx3Zkl66KL9iYbpap-0n1YRb9hdM2Z0s7e6bwGR9e_T5_G0HxLe2ciaeP3rDxC_3uExp1cSflzNn3dNtj08xeh7PmBTFxODAoGdwcIFKUtvUcx1DJs5AMvEO-1-4ggDJmXjhBj0SfuBZ9_L5vo0uEF-UCzequwR5QlpTKF-9KFQ8Li4s6rXc654aKOHqMjw0UFjhuRRY4GXR72aXMn0X9_se3pY_GCCaKXraxXRiMP7FYDyopk2_mT9jZQZhetGrCoe97Dt5aPtDV9lBmUNXC1XLuZYN4L5tTQtNLfpJNTO2unID1CD29b6vBUjodrNoBMi-OShQrTSKNTUuyvld8VqJXbmcVxxk37ZN5dWEPm8mBgh45dshAyieTsPmz2k9ZdbU3mXKnyzkyOPwoy7E4z854Kbe_CFfsvifEr7pt1qT__l_yFZA8f1W4N8BAAD___xhcUU">