summaryrefslogtreecommitdiffstats
path: root/libcxx/include/algorithm
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2019-03-08 22:58:59 +0000
committerEric Fiselier <eric@efcs.ca>2019-03-08 22:58:59 +0000
commit6e4ec6022f7936b88b42a30f6d64a787609284a9 (patch)
tree221964df613526bc5ec78e8f41491daab307488f /libcxx/include/algorithm
parentce3be45cacc168194bb7d5e84de365548e1c49a2 (diff)
downloadbcm5719-llvm-6e4ec6022f7936b88b42a30f6d64a787609284a9.tar.gz
bcm5719-llvm-6e4ec6022f7936b88b42a30f6d64a787609284a9.zip
Fix PR41017 - Build failure with _LIBCPP_DEBUG=0 and non-const-ref
comparator for std::sort() Our debug comparator assumed that the comparator it wraps would always accepts the values by const ref. This isn't required by the standard. This patch makes our __debug_less comparator forward the constness. llvm-svn: 355752
Diffstat (limited to 'libcxx/include/algorithm')
-rw-r--r--libcxx/include/algorithm10
1 files changed, 5 insertions, 5 deletions
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 7da753a490d..cb619c264fd 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -784,7 +784,7 @@ struct __debug_less
__debug_less(_Compare& __c) : __comp_(__c) {}
template <class _Tp, class _Up>
- bool operator()(const _Tp& __x, const _Up& __y)
+ bool operator()(_Tp& __x, _Up& __y)
{
bool __r = __comp_(__x, __y);
if (__r)
@@ -795,18 +795,18 @@ struct __debug_less
template <class _LHS, class _RHS>
inline _LIBCPP_INLINE_VISIBILITY
decltype((void)_VSTD::declval<_Compare&>()(
- _VSTD::declval<_LHS const&>(), _VSTD::declval<_RHS const&>()))
- __do_compare_assert(int, _LHS const& __l, _RHS const& __r) {
+ _VSTD::declval<_LHS &>(), _VSTD::declval<_RHS &>()))
+ __do_compare_assert(int, _LHS & __l, _RHS & __r) {
_LIBCPP_ASSERT(!__comp_(__l, __r),
"Comparator does not induce a strict weak ordering");
}
template <class _LHS, class _RHS>
inline _LIBCPP_INLINE_VISIBILITY
- void __do_compare_assert(long, _LHS const&, _RHS const&) {}
+ void __do_compare_assert(long, _LHS &, _RHS &) {}
};
-#endif // _LIBCPP_DEBUG
+#endif // _LIBCPP_DEBUG
// all_of
OpenPOWER on IntegriCloud