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 /libcxx/test/std/utilities/memory | |
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
Diffstat (limited to 'libcxx/test/std/utilities/memory')
-rw-r--r-- | libcxx/test/std/utilities/memory/storage.iterator/raw_storag_iterator.pass.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
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 } |