aboutsummaryrefslogtreecommitdiff
path: root/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp')
-rw-r--r--test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
new file mode 100644
index 000000000000..af1b7e20c338
--- /dev/null
+++ b/test/std/containers/container.adaptors/queue/queue.defn/assign_move.pass.cpp
@@ -0,0 +1,42 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <queue>
+
+// queue& operator=(queue&& q);
+
+#include <queue>
+#include <cassert>
+
+#include "MoveOnly.h"
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template <class C>
+C
+make(int n)
+{
+ C c;
+ for (int i = 0; i < n; ++i)
+ c.push_back(MoveOnly(i));
+ return c;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));
+ std::queue<MoveOnly> q2;
+ q2 = std::move(q);
+ assert(q2.size() == 5);
+ assert(q.empty());
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+}