[X86] combinePTESTCC - fold PTESTC(PCMPEQ(X,0),-1) == PTESTZ(X,X) (#123466)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / reference / ctor_copy.pass.cpp
blob46ac18ab493b7a66289d7abce2a21002a13228c0
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>
11 // reference(const reference&)
13 #include <cassert>
14 #include <vector>
16 #include "test_macros.h"
18 TEST_CONSTEXPR_CXX20 bool test() {
19 std::vector<bool> vec;
20 typedef std::vector<bool>::reference Ref;
21 vec.push_back(true);
22 Ref ref = vec[0];
23 Ref ref2 = ref;
24 assert(ref == ref2 && ref2);
25 ref.flip();
26 assert(ref == ref2 && !ref2);
28 return true;
31 int main(int, char**) {
32 test();
33 #if TEST_STD_VER > 17
34 static_assert(test());
35 #endif
37 return 0;