diff --git a/libcxx/include/iterator b/libcxx/include/iterator index 5aa784f2e611..4c6b0a6075b9 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -536,8 +536,6 @@ class _LIBCPP_TYPE_VIS_ONLY reverse_iterator typename iterator_traits<_Iter>::pointer, typename iterator_traits<_Iter>::reference> { -private: - mutable _Iter __t; protected: _Iter current; public: @@ -547,11 +545,11 @@ public: typedef typename iterator_traits<_Iter>::pointer pointer; _LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {} - _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} + _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : current(__x) {} template _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u) - : __t(__u.base()), current(__u.base()) {} + : current(__u.base()) {} _LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;} - _LIBCPP_INLINE_VISIBILITY reference operator*() const {__t = current; return *--__t;} + _LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;} _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());} _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;} _LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int) diff --git a/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp b/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp index 7055e27bb248..7a7759843eea 100644 --- a/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp +++ b/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.op.star/op_star.pass.cpp @@ -15,6 +15,8 @@ // Be sure to respect LWG 198: // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198 +// LWG 198 was superseded by LWG 2360 +// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360 #include #include @@ -30,26 +32,6 @@ public: {return x.data_ == y.data_;} }; -template -class weird_iterator -{ - It it_; -public: - typedef It value_type; - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - typedef It* pointer; - typedef It& reference; - - weird_iterator() {} - explicit weird_iterator(It it) : it_(it) {} - ~weird_iterator() {it_ = It();} - - reference operator*() {return it_;} - - weird_iterator& operator--() {return *this;} -}; - template void test(It i, typename std::iterator_traits::value_type x) @@ -60,7 +42,6 @@ test(It i, typename std::iterator_traits::value_type x) int main() { - test(weird_iterator(A()), A()); A a; test(&a+1, A()); } diff --git a/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp b/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp index fc57deab6789..efbdf1406c96 100644 --- a/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp +++ b/libcxx/test/iterators/predef.iterators/reverse.iterators/reverse.iter.ops/reverse.iter.opref/op_arrow.pass.cpp @@ -15,6 +15,9 @@ // Be sure to respect LWG 198: // http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#198 +// LWG 198 was superseded by LWG 2360 +// http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#2360 + #include #include @@ -33,27 +36,6 @@ public: {return x.data_ == y.data_;} }; -template -class weird_iterator -{ - It it_; -public: - typedef It value_type; - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - typedef It* pointer; - typedef It& reference; - - weird_iterator() {} - explicit weird_iterator(It it) : it_(it) {} - ~weird_iterator() {it_ = It();} - - reference operator*() {return it_;} - pointer operator->() {return &it_;} - - weird_iterator& operator--() {return *this;} -}; - template void test(It i, typename std::iterator_traits::value_type x) @@ -79,7 +61,6 @@ public: int main() { - test(weird_iterator(A()), A()); A a; test(&a+1, A()); diff --git a/libcxx/www/cxx1y_status.html b/libcxx/www/cxx1y_status.html index c282572ec3c9..199cf4fc3874 100644 --- a/libcxx/www/cxx1y_status.html +++ b/libcxx/www/cxx1y_status.html @@ -265,7 +265,7 @@ 2356Stability of erasure in unordered associative containersIssaquahComplete 2357Remaining "Assignable" requirementIssaquahComplete 2359How does regex_constants::nosubs affect basic_regex::mark_count()?IssaquahComplete - 2360reverse_iterator::operator*() is unimplementableIssaquah + 2360reverse_iterator::operator*() is unimplementableIssaquahComplete 2104unique_lock move-assignment should not be noexceptIssaquah 2186Incomplete action on async/launch::deferredIssaquah 2075Progress guarantees, lock-free property, and scheduling assumptionsIssaquah