Author: marshall Date: Sun Apr 10 22:54:53 2016 New Revision: 265914 URL: http://llvm.org/viewvc/llvm-project?rev=265914&view=rev Log: Implement LWG#680, which was missed lo these many moons ago, and was reported as bug #27259. As a drive-by fix, replace the hand-rolled equivalent to addressof in __wrap_iter with the real thing.
Modified: libcxx/trunk/include/iterator libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp Modified: libcxx/trunk/include/iterator URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=265914&r1=265913&r2=265914&view=diff ============================================================================== --- libcxx/trunk/include/iterator (original) +++ libcxx/trunk/include/iterator Sun Apr 10 22:54:53 2016 @@ -949,7 +949,7 @@ public: typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; typedef typename iterator_traits<iterator_type>::value_type value_type; typedef typename iterator_traits<iterator_type>::difference_type difference_type; - typedef typename iterator_traits<iterator_type>::pointer pointer; + typedef iterator_type pointer; #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES typedef value_type&& reference; #else @@ -964,10 +964,7 @@ public: _LIBCPP_INLINE_VISIBILITY reference operator*() const { return static_cast<reference>(*__i); } - _LIBCPP_INLINE_VISIBILITY pointer operator->() const { - typename iterator_traits<iterator_type>::reference __ref = *__i; - return &__ref; - } + _LIBCPP_INLINE_VISIBILITY pointer operator->() const { return __i;} _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;} _LIBCPP_INLINE_VISIBILITY move_iterator operator++(int) {move_iterator __tmp(*this); ++__i; return __tmp;} @@ -1185,7 +1182,7 @@ public: _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable iterator"); #endif - return (pointer)&reinterpret_cast<const volatile char&>(*__i); + return (pointer)_VSTD::addressof(*__i); } _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT { Modified: libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp?rev=265914&r1=265913&r2=265914&view=diff ============================================================================== --- libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/predef.iterators/move.iterators/move.iterator/types.pass.cpp Sun Apr 10 22:54:53 2016 @@ -18,7 +18,7 @@ // public: // typedef Iter iterator_type; // typedef Iter::difference_type difference_type; -// typedef Iterator pointer; +// typedef Iter pointer; // typedef Iter::value_type value_type; // typedef value_type&& reference; // }; @@ -36,7 +36,7 @@ test() typedef std::iterator_traits<It> T; static_assert((std::is_same<typename R::iterator_type, It>::value), ""); static_assert((std::is_same<typename R::difference_type, typename T::difference_type>::value), ""); - static_assert((std::is_same<typename R::pointer, typename T::pointer>::value), ""); + static_assert((std::is_same<typename R::pointer, It>::value), ""); static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), ""); #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES static_assert((std::is_same<typename R::reference, typename R::value_type&&>::value), ""); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits