[VPlan] Add and use debug location for VPScalarCastRecipe.
[llvm-project.git] / libcxx / test / std / containers / sequences / list / list.cons / move.pass.cpp
blobd5e09ca902fee30c8b1d73cfbabf59dd7cbd80fd
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-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03
11 // <list>
13 // list(list&& c);
15 #include <list>
16 #include <cassert>
17 #include "test_macros.h"
18 #include "MoveOnly.h"
19 #include "test_allocator.h"
20 #include "min_allocator.h"
22 int main(int, char**)
25 std::list<MoveOnly, test_allocator<MoveOnly> > l(test_allocator<MoveOnly>(5));
26 std::list<MoveOnly, test_allocator<MoveOnly> > lo(test_allocator<MoveOnly>(5));
27 for (int i = 1; i <= 3; ++i)
29 l.push_back(i);
30 lo.push_back(i);
32 std::list<MoveOnly, test_allocator<MoveOnly> >::iterator it = l.begin();
33 std::list<MoveOnly, test_allocator<MoveOnly> > l2 = std::move(l);
34 assert(l2 == lo);
35 assert(l.empty());
36 assert(l2.get_allocator() == lo.get_allocator());
37 assert(it == l2.begin()); // Iterators remain valid
40 std::list<MoveOnly, other_allocator<MoveOnly> > l(other_allocator<MoveOnly>(5));
41 std::list<MoveOnly, other_allocator<MoveOnly> > lo(other_allocator<MoveOnly>(5));
42 for (int i = 1; i <= 3; ++i)
44 l.push_back(i);
45 lo.push_back(i);
47 std::list<MoveOnly, other_allocator<MoveOnly> >::iterator it = l.begin();
48 std::list<MoveOnly, other_allocator<MoveOnly> > l2 = std::move(l);
49 assert(l2 == lo);
50 assert(l.empty());
51 assert(l2.get_allocator() == lo.get_allocator());
52 assert(it == l2.begin()); // Iterators remain valid
55 std::list<MoveOnly, min_allocator<MoveOnly> > l(min_allocator<MoveOnly>{});
56 std::list<MoveOnly, min_allocator<MoveOnly> > lo(min_allocator<MoveOnly>{});
57 for (int i = 1; i <= 3; ++i)
59 l.push_back(i);
60 lo.push_back(i);
62 std::list<MoveOnly, min_allocator<MoveOnly> >::iterator it = l.begin();
63 std::list<MoveOnly, min_allocator<MoveOnly> > l2 = std::move(l);
64 assert(l2 == lo);
65 assert(l.empty());
66 assert(l2.get_allocator() == lo.get_allocator());
67 assert(it == l2.begin()); // Iterators remain valid
70 return 0;