[libcxx-commits] [libcxx] 8c98ce4 - [libc++] Fix a typo in reverse_iterator::operator=.

Arthur O'Dwyer via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jan 27 11:22:08 PST 2022


Author: Arthur O'Dwyer
Date: 2022-01-27T14:21:50-05:00
New Revision: 8c98ce4dfa7966db48ca22ae6b2a9b6c3cc69648

URL: https://github.com/llvm/llvm-project/commit/8c98ce4dfa7966db48ca22ae6b2a9b6c3cc69648
DIFF: https://github.com/llvm/llvm-project/commit/8c98ce4dfa7966db48ca22ae6b2a9b6c3cc69648.diff

LOG: [libc++] Fix a typo in reverse_iterator::operator=.

We should be checking `is_assignable<It&, ...>`.
`is_assignable<It, ...>` checks for an rvalue left-hand side, which
is basically never assignable-to.
Found while looking into https://cplusplus.github.io/LWG/issue3435 .

Differential Revision: https://reviews.llvm.org/D117660

Added: 
    

Modified: 
    libcxx/include/__iterator/reverse_iterator.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__iterator/reverse_iterator.h b/libcxx/include/__iterator/reverse_iterator.h
index 454054534e55e..449eb529aa983 100644
--- a/libcxx/include/__iterator/reverse_iterator.h
+++ b/libcxx/include/__iterator/reverse_iterator.h
@@ -77,7 +77,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
     template <class _Up, class = __enable_if_t<
         !is_same<_Up, _Iter>::value &&
         is_convertible<_Up const&, _Iter>::value &&
-        is_assignable<_Iter, _Up const&>::value
+        is_assignable<_Iter&, _Up const&>::value
     > >
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {
@@ -102,7 +102,7 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
     template <class _Up, class = __enable_if_t<
         !is_same<_Up, _Iter>::value &&
         is_convertible<_Up const&, _Iter>::value &&
-        is_assignable<_Iter, _Up const&>::value
+        is_assignable<_Iter&, _Up const&>::value
     > >
     _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
     reverse_iterator& operator=(const reverse_iterator<_Up>& __u) {


        


More information about the libcxx-commits mailing list