[libcxx-commits] [libcxx] 9571b8f - [libc++] [LIBCXX-DEBUG-FIXME] std::advance shouldn't use ADL `>=` on the _Distance type.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 5 13:23:48 PDT 2021
Author: Arthur O'Dwyer
Date: 2021-05-05T16:21:09-04:00
New Revision: 9571b8f238f97bce01bcf3c84a4f87cfb1c00dbf
URL: https://github.com/llvm/llvm-project/commit/9571b8f238f97bce01bcf3c84a4f87cfb1c00dbf
DIFF: https://github.com/llvm/llvm-project/commit/9571b8f238f97bce01bcf3c84a4f87cfb1c00dbf.diff
LOG: [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
Added:
Modified:
libcxx/include/iterator
libcxx/test/std/iterators/iterator.primitives/iterator.operations/robust_against_adl.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index ad98d8ca7b704..1d308a2fa7bd7 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -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());
}
diff --git a/libcxx/test/std/iterators/iterator.primitives/iterator.operations/robust_against_adl.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/iterator.operations/robust_against_adl.pass.cpp
index ace0356afde01..32d770ed4f91b 100644
--- a/libcxx/test/std/iterators/iterator.primitives/iterator.operations/robust_against_adl.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.primitives/iterator.operations/robust_against_adl.pass.cpp
@@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// XFAIL: LIBCXX-DEBUG-FIXME
-
// <iterator>
#include <iterator>
More information about the libcxx-commits
mailing list