[flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / reference.swap.pass.cpp
blob8879d1f1d358cfb516ffc3448997a7f41b3a1105
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 // <vector>
10 // vector<bool>
12 // static void swap(reference x, reference y) noexcept;
14 #include <vector>
15 #include <cassert>
17 #include "test_macros.h"
19 TEST_CONSTEXPR_CXX20 bool tests()
22 bool a[] = {false, true, false, true};
23 bool* an = a + sizeof(a)/sizeof(a[0]);
25 std::vector<bool> v(a, an);
26 std::vector<bool>::reference r1 = v[0];
27 std::vector<bool>::reference r2 = v[3];
29 #if TEST_STD_VER >= 11
30 static_assert((noexcept(v.swap(r1,r2))), "");
31 #endif
33 assert(!r1);
34 assert( r2);
35 v.swap(r1, r2);
36 assert( r1);
37 assert(!r2);
39 return true;
42 int main(int, char**)
44 tests();
45 #if TEST_STD_VER > 17
46 static_assert(tests());
47 #endif
48 return 0;