[libcxx] r220715 - Fix use of operator comma in is_permutation and delete comma operator for test iterators.
Eric Fiselier
eric at efcs.ca
Mon Oct 27 13:26:26 PDT 2014
Author: ericwf
Date: Mon Oct 27 15:26:25 2014
New Revision: 220715
URL: http://llvm.org/viewvc/llvm-project?rev=220715&view=rev
Log:
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.
Modified:
libcxx/trunk/include/algorithm
libcxx/trunk/test/support/test_iterators.h
Modified: libcxx/trunk/include/algorithm
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=220715&r1=220714&r2=220715&view=diff
==============================================================================
--- libcxx/trunk/include/algorithm (original)
+++ libcxx/trunk/include/algorithm Mon Oct 27 15:26:25 2014
@@ -1327,7 +1327,7 @@ __is_permutation(_ForwardIterator1 __fir
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;
Modified: libcxx/trunk/test/support/test_iterators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/test_iterators.h?rev=220715&r1=220714&r2=220715&view=diff
==============================================================================
--- libcxx/trunk/test/support/test_iterators.h (original)
+++ libcxx/trunk/test/support/test_iterators.h Mon Oct 27 15:26:25 2014
@@ -13,6 +13,12 @@
#include <iterator>
#include <cassert>
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define DELETE_FUNCTION = delete
+#else
+#define DELETE_FUNCTION
+#endif
+
template <class It>
class output_iterator
{
@@ -40,7 +46,7 @@ public:
{output_iterator tmp(*this); ++(*this); return tmp;}
template <class T>
- void operator,(T const &);
+ void operator,(T const &) DELETE_FUNCTION;
};
template <class It>
@@ -76,7 +82,7 @@ public:
{return !(x == y);}
template <class T>
- void operator,(T const &);
+ void operator,(T const &) DELETE_FUNCTION;
};
template <class T, class U>
@@ -128,7 +134,7 @@ public:
{return !(x == y);}
template <class T>
- void operator,(T const &);
+ void operator,(T const &) DELETE_FUNCTION;
};
template <class T, class U>
@@ -179,7 +185,7 @@ public:
{bidirectional_iterator tmp(*this); --(*this); return tmp;}
template <class T>
- void operator,(T const &);
+ void operator,(T const &) DELETE_FUNCTION;
};
template <class T, class U>
@@ -241,7 +247,7 @@ public:
reference operator[](difference_type n) const {return it_[n];}
template <class T>
- void operator,(T const &);
+ void operator,(T const &) DELETE_FUNCTION;
};
template <class T, class U>
@@ -423,4 +429,6 @@ inline Iter base(comma_iterator<Iter> i)
template <class Iter> // everything else
inline Iter base(Iter i) { return i; }
+#undef DELETE_FUNCTION
+
#endif // ITERATORS_H
More information about the cfe-commits
mailing list