[Arm] Fix generating code with UB in NeonEmitter (#121802)
[llvm-project.git] / libcxx / test / std / containers / container.adaptors / queue / queue.special / swap.pass.cpp
blob56fbb7418ac9bc2448ad41b2cf098960b0cb1e72
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 // <queue>
11 // template <class T, class Container>
12 // void swap(queue<T, Container>& x, queue<T, Container>& y);
14 #include <queue>
15 #include <cassert>
17 #include "test_macros.h"
19 template <class C>
21 make(int n)
23 C c;
24 for (int i = 0; i < n; ++i)
25 c.push(i);
26 return c;
29 int main(int, char**)
31 std::queue<int> q1 = make<std::queue<int> >(5);
32 std::queue<int> q2 = make<std::queue<int> >(10);
33 std::queue<int> q1_save = q1;
34 std::queue<int> q2_save = q2;
35 swap(q1, q2);
36 assert(q1 == q2_save);
37 assert(q2 == q1_save);
39 return 0;