Skip to content

Commit

Permalink
[libc++] Fix a typo in reverse_iterator::operator=.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Arthur O'Dwyer committed Jan 27, 2022
1 parent 9be5f4d commit 8c98ce4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/__iterator/reverse_iterator.h
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 8c98ce4

Please sign in to comment.