forked from OSchip/llvm-project
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.
llvm-svn: 265914
This commit is contained in:
parent
a07ad647ee
commit
05333fc8af
|
@ -949,7 +949,7 @@ public:
|
||||||
typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
|
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>::value_type value_type;
|
||||||
typedef typename iterator_traits<iterator_type>::difference_type difference_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
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
typedef value_type&& reference;
|
typedef value_type&& reference;
|
||||||
#else
|
#else
|
||||||
|
@ -964,10 +964,7 @@ public:
|
||||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
|
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
|
||||||
return static_cast<reference>(*__i);
|
return static_cast<reference>(*__i);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
|
_LIBCPP_INLINE_VISIBILITY pointer operator->() const { return __i;}
|
||||||
typename iterator_traits<iterator_type>::reference __ref = *__i;
|
|
||||||
return &__ref;
|
|
||||||
}
|
|
||||||
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
|
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
|
||||||
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
|
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
|
||||||
{move_iterator __tmp(*this); ++__i; return __tmp;}
|
{move_iterator __tmp(*this); ++__i; return __tmp;}
|
||||||
|
@ -1185,7 +1182,7 @@ public:
|
||||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||||
"Attempted to dereference a non-dereferenceable iterator");
|
"Attempted to dereference a non-dereferenceable iterator");
|
||||||
#endif
|
#endif
|
||||||
return (pointer)&reinterpret_cast<const volatile char&>(*__i);
|
return (pointer)_VSTD::addressof(*__i);
|
||||||
}
|
}
|
||||||
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
|
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
// public:
|
// public:
|
||||||
// typedef Iter iterator_type;
|
// typedef Iter iterator_type;
|
||||||
// typedef Iter::difference_type difference_type;
|
// typedef Iter::difference_type difference_type;
|
||||||
// typedef Iterator pointer;
|
// typedef Iter pointer;
|
||||||
// typedef Iter::value_type value_type;
|
// typedef Iter::value_type value_type;
|
||||||
// typedef value_type&& reference;
|
// typedef value_type&& reference;
|
||||||
// };
|
// };
|
||||||
|
@ -36,7 +36,7 @@ test()
|
||||||
typedef std::iterator_traits<It> T;
|
typedef std::iterator_traits<It> T;
|
||||||
static_assert((std::is_same<typename R::iterator_type, It>::value), "");
|
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::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), "");
|
static_assert((std::is_same<typename R::value_type, typename T::value_type>::value), "");
|
||||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||||
static_assert((std::is_same<typename R::reference, typename R::value_type&&>::value), "");
|
static_assert((std::is_same<typename R::reference, typename R::value_type&&>::value), "");
|
||||||
|
|
Loading…
Reference in New Issue