[libc++] [LIBCXX-DEBUG-FIXME] std::advance shouldn't use ADL `>=` on the _Distance type.

Convert to a primitive type first; then use primitive `>=` on that value.

Differential Revision: https://reviews.llvm.org/D101678
This commit is contained in:
Arthur O'Dwyer 2021-04-20 15:59:22 -04:00
parent 165ad89947
commit 9571b8f238
2 changed files with 2 additions and 4 deletions

View File

@ -538,10 +538,10 @@ template <class _InputIter, class _Distance>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
void advance(_InputIter& __i, _Distance __orig_n)
{
_LIBCPP_ASSERT(__orig_n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
"Attempt to advance(it, n) with negative n on a non-bidirectional iterator");
typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
_IntegralSize __n = __orig_n;
_LIBCPP_ASSERT(__n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
"Attempt to advance(it, n) with negative n on a non-bidirectional iterator");
_VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
}

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: LIBCXX-DEBUG-FIXME
// <iterator>
#include <iterator>