diff options
| author | Eric Fiselier <eric@efcs.ca> | 2014-10-27 19:28:20 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2014-10-27 19:28:20 +0000 |
| commit | 910285b238910084aabe786178337b158b82a3bb (patch) | |
| tree | 983346d157ad4ff829f679c4d3f7639e47fd24d8 /libcxx/test | |
| parent | f2896281784aa7a2e279559dc935a3250d85c2ca (diff) | |
| download | bcm5719-llvm-910285b238910084aabe786178337b158b82a3bb.tar.gz bcm5719-llvm-910285b238910084aabe786178337b158b82a3bb.zip | |
[libcxx] Fix use of operator comma where the types can be user defined
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5929
llvm-svn: 220706
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp | 2 | ||||
| -rw-r--r-- | libcxx/test/support/test_iterators.h | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libcxx/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp b/libcxx/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp index fb3765d2030..0b348e6920c 100644 --- a/libcxx/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp +++ b/libcxx/test/containers/sequences/forwardlist/forwardlist.cons/assign_range.pass.cpp @@ -70,7 +70,7 @@ int main() typedef input_iterator<const T*> I; c.assign(I(std::begin(t0)), I(std::end(t0))); int n = 0; - for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, ++n) + for (C::const_iterator i = c.cbegin(); i != c.cend(); ++i, (void) ++n) assert(*i == 10+n); assert(n == 4); } diff --git a/libcxx/test/support/test_iterators.h b/libcxx/test/support/test_iterators.h index cf164be806d..71509083e13 100644 --- a/libcxx/test/support/test_iterators.h +++ b/libcxx/test/support/test_iterators.h @@ -38,6 +38,9 @@ public: output_iterator& operator++() {++it_; return *this;} output_iterator operator++(int) {output_iterator tmp(*this); ++(*this); return tmp;} + + template <class T> + void operator,(T const &); }; template <class It> @@ -71,6 +74,9 @@ public: {return x.it_ == y.it_;} friend bool operator!=(const input_iterator& x, const input_iterator& y) {return !(x == y);} + + template <class T> + void operator,(T const &); }; template <class T, class U> @@ -120,6 +126,9 @@ public: {return x.it_ == y.it_;} friend bool operator!=(const forward_iterator& x, const forward_iterator& y) {return !(x == y);} + + template <class T> + void operator,(T const &); }; template <class T, class U> @@ -168,6 +177,9 @@ public: bidirectional_iterator& operator--() {--it_; return *this;} bidirectional_iterator operator--(int) {bidirectional_iterator tmp(*this); --(*this); return tmp;} + + template <class T> + void operator,(T const &); }; template <class T, class U> @@ -227,6 +239,9 @@ public: {random_access_iterator tmp(*this); tmp -= n; return tmp;} reference operator[](difference_type n) const {return it_[n];} + + template <class T> + void operator,(T const &); }; template <class T, class U> |

