diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2015-10-25 18:58:07 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2015-10-25 18:58:07 +0000 |
| commit | 2603b0758d69c72446665d31263edb1b582b68d6 (patch) | |
| tree | 48fb2d6bbd046dbda70080ac02b5966cf6838925 | |
| parent | 9be53564520603a4391637e4132942913f79aac4 (diff) | |
| download | bcm5719-llvm-2603b0758d69c72446665d31263edb1b582b68d6.tar.gz bcm5719-llvm-2603b0758d69c72446665d31263edb1b582b68d6.zip | |
Fix LWG#2127: Move-construction with raw_storage_iterator.
llvm-svn: 251247
| -rw-r--r-- | libcxx/include/memory | 4 | ||||
| -rw-r--r-- | libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp | 27 | ||||
| -rw-r--r-- | libcxx/www/cxx1z_status.html | 2 |
3 files changed, 28 insertions, 5 deletions
diff --git a/libcxx/include/memory b/libcxx/include/memory index 4ed33084d95..97ad440367b 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 f77d6c75e17..914802423ce 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 <type_traits> #include <cassert> +#include <MoveOnly.h> + int A_constructed = 0; struct A @@ -29,16 +31,33 @@ public: int main() { - typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type + { + typedef A S; + typedef std::aligned_storage<3*sizeof(S), std::alignment_of<S>::value>::type Storage; Storage buffer; - std::raw_storage_iterator<A*, A> it((A*)&buffer); + std::raw_storage_iterator<S*, S> 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<S>::value>::type + Storage; + Storage buffer; + std::raw_storage_iterator<S*, S> 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 d30d1cb376f..1df7401e28b 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -152,7 +152,7 @@ <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2101">2101</a></td><td>Some transformation types can produce impossible types</td><td>Kona</td><td></td></tr> <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2111">2111</a></td><td>Which <tt>unexpected</tt>/<tt>terminate</tt> handler is called from the exception handling runtime?</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2119">2119</a></td><td>Missing <tt>hash</tt> specializations for extended integer types</td><td>Kona</td><td></td></tr> - <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2127">2127</a></td><td>Move-construction with <tt>raw_storage_iterator</tt></td><td>Kona</td><td>Patch Ready</td></tr> + <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2127">2127</a></td><td>Move-construction with <tt>raw_storage_iterator</tt></td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2133">2133</a></td><td>Attitude to overloaded comma for iterators</td><td>Kona</td><td>Complete</td></tr> <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2156">2156</a></td><td>Unordered containers' <tt>reserve(n)</tt> reserves for <tt>n-1</tt> elements</td><td>Kona</td><td></td></tr> <tr><td><a href="http://cplusplus.github.io/LWG/lwg-defects.html#2218">2218</a></td><td>Unclear how containers use <tt>allocator_traits::construct()</tt></td><td>Kona</td><td></td></tr> |

