From 62a0e01343c3d0f0cbec27e31fcbc409e6e4aa23 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Mon, 27 Oct 2014 20:26:25 +0000 Subject: [PATCH] Fix use of operator comma in is_permutation and delete comma operator for test iterators. The comma operators in the test iterators give better error messages when they are deleted as opposed to not defined. Delete these functions when possible. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220715 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/algorithm | 2 +- test/support/test_iterators.h | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/algorithm b/include/algorithm index e003a59e3..02cbc816f 100644 --- a/include/algorithm +++ b/include/algorithm @@ -1327,7 +1327,7 @@ __is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1, forward_iterator_tag, forward_iterator_tag ) { // shorten sequences as much as possible by lopping of any equal parts - for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2) + for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void) ++__first2) if (!__pred(*__first1, *__first2)) goto __not_done; return __first1 == __last1 && __first2 == __last2; diff --git a/test/support/test_iterators.h b/test/support/test_iterators.h index 71509083e..b91653dc9 100644 --- a/test/support/test_iterators.h +++ b/test/support/test_iterators.h @@ -13,6 +13,12 @@ #include #include +#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS +#define DELETE_FUNCTION = delete +#else +#define DELETE_FUNCTION +#endif + template class output_iterator { @@ -40,7 +46,7 @@ public: {output_iterator tmp(*this); ++(*this); return tmp;} template - void operator,(T const &); + void operator,(T const &) DELETE_FUNCTION; }; template @@ -76,7 +82,7 @@ public: {return !(x == y);} template - void operator,(T const &); + void operator,(T const &) DELETE_FUNCTION; }; template @@ -128,7 +134,7 @@ public: {return !(x == y);} template - void operator,(T const &); + void operator,(T const &) DELETE_FUNCTION; }; template @@ -179,7 +185,7 @@ public: {bidirectional_iterator tmp(*this); --(*this); return tmp;} template - void operator,(T const &); + void operator,(T const &) DELETE_FUNCTION; }; template @@ -241,7 +247,7 @@ public: reference operator[](difference_type n) const {return it_[n];} template - void operator,(T const &); + void operator,(T const &) DELETE_FUNCTION; }; template @@ -423,4 +429,6 @@ inline Iter base(comma_iterator i) { return i.base(); } template // everything else inline Iter base(Iter i) { return i; } +#undef DELETE_FUNCTION + #endif // ITERATORS_H