[libcxx-commits] [libcxx] [libc++] <algorithm>: __is_callable checks whether the callable can be called with rvalue (PR #73451)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 27 07:31:38 PST 2023


================
@@ -60,8 +60,9 @@ __equal_range(_Iter __first, _Sent __last, const _Tp& __value, _Compare&& __comp
 template <class _ForwardIterator, class _Tp, class _Compare>
 _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_ForwardIterator, _ForwardIterator>
 equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp) {
-  static_assert(__is_callable<_Compare, decltype(*__first), const _Tp&>::value,
-                "The comparator has to be callable");
+  static_assert(__is_callable<_Compare&, decltype(*__first), const _Tp&>::value, "The comparator has to be callable");
----------------
ldionne wrote:

You missed some algorithms that use `__is_callable`. Please grep the codebase. I found at least `search_n` that also had this issue, I think.

https://github.com/llvm/llvm-project/pull/73451


More information about the libcxx-commits mailing list