[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / vector_bool.pass.cpp
blobb927f2a4dbdde666d12ec1cd46a1cd060748fb7e
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 // <functional>
11 // template <class T>
12 // struct hash
13 // {
14 // size_t operator()(T val) const;
15 // };
17 // Not very portable
19 #include <vector>
20 #include <cassert>
21 #include <iterator>
22 #include <type_traits>
24 #include "test_macros.h"
25 #include "min_allocator.h"
27 TEST_CONSTEXPR_CXX20 bool tests()
30 typedef std::vector<bool> T;
31 typedef std::hash<T> H;
32 #if TEST_STD_VER <= 14
33 static_assert((std::is_same<H::argument_type, T>::value), "" );
34 static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
35 #endif
36 ASSERT_NOEXCEPT(H()(T()));
38 bool ba[] = {true, false, true, true, false};
39 T vb(std::begin(ba), std::end(ba));
40 H h;
41 assert(h(vb) != 0);
43 #if TEST_STD_VER >= 11
45 typedef std::vector<bool, min_allocator<bool>> T;
46 typedef std::hash<T> H;
47 #if TEST_STD_VER <= 14
48 static_assert((std::is_same<H::argument_type, T>::value), "" );
49 static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
50 #endif
51 ASSERT_NOEXCEPT(H()(T()));
52 bool ba[] = {true, false, true, true, false};
53 T vb(std::begin(ba), std::end(ba));
54 H h;
55 assert(h(vb) != 0);
57 #endif
59 return true;
62 int main(int, char**)
64 tests();
65 #if TEST_STD_VER > 17
66 static_assert(tests());
67 #endif
68 return 0;