38 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++0310 11// <queue>12 13// queue& operator=(queue&& q);14 15#include <queue>16#include <cassert>17 18#include "test_macros.h"19#include "MoveOnly.h"20 21template <class C>22C make(int n) {23 C c;24 for (int i = 0; i < n; ++i)25 c.push_back(MoveOnly(i));26 return c;27}28 29int main(int, char**) {30 std::queue<MoveOnly> q(make<std::deque<MoveOnly> >(5));31 std::queue<MoveOnly> q2;32 q2 = std::move(q);33 assert(q2.size() == 5);34 assert(q.empty());35 36 return 0;37}38