diff --git a/libcxx/include/memory b/libcxx/include/memory index 4ed33084d959..97ad440367b2 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -1909,6 +1909,10 @@ public: _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element) {::new(&*__x_) _Tp(__element); return *this;} +#if _LIBCPP_STD_VER >= 14 + _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element) + {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;} +#endif _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) {raw_storage_iterator __t(*this); ++__x_; return __t;} diff --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp index f77d6c75e17a..914802423ce7 100644 --- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp +++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp @@ -13,6 +13,8 @@ #include #include +#include + int A_constructed = 0; struct A @@ -29,16 +31,33 @@ public: int main() { - typedef std::aligned_storage<3*sizeof(A), std::alignment_of::value>::type + { + typedef A S; + typedef std::aligned_storage<3*sizeof(S), std::alignment_of::value>::type Storage; Storage buffer; - std::raw_storage_iterator it((A*)&buffer); + std::raw_storage_iterator it((S*)&buffer); assert(A_constructed == 0); for (int i = 0; i < 3; ++i) { - *it++ = A(i+1); - A* ap = (A*)&buffer + i; + *it++ = S(i+1); + S* ap = (S*)&buffer + i; assert(*ap == i+1); assert(A_constructed == i+1); } + } +#if _LIBCPP_STD_VER >= 14 + { + typedef MoveOnly S; + typedef std::aligned_storage<3*sizeof(S), std::alignment_of::value>::type + Storage; + Storage buffer; + std::raw_storage_iterator it((S*)&buffer); + S m{1}; + *it++ = std::move(m); + assert(m.get() == 0); // moved from + S *ap = (S*) &buffer; + assert(ap->get() == 1); // original value + } +#endif } diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index d30d1cb376f3..1df7401e28b3 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -152,7 +152,7 @@ 2101Some transformation types can produce impossible typesKona 2111Which unexpected/terminate handler is called from the exception handling runtime?KonaComplete 2119Missing hash specializations for extended integer typesKona - 2127Move-construction with raw_storage_iteratorKonaPatch Ready + 2127Move-construction with raw_storage_iteratorKonaComplete 2133Attitude to overloaded comma for iteratorsKonaComplete 2156Unordered containers' reserve(n) reserves for n-1 elementsKona 2218Unclear how containers use allocator_traits::construct()Kona