Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / template.bitset / bitset.members / reset_all.pass.cpp
blob9f77cca456abbcf4b88fd115f7dfbc514faa0e77
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 // bitset<N>& reset(); // constexpr since C++23
11 #include <bitset>
12 #include <cassert>
13 #include <cstddef>
15 #include "test_macros.h"
17 template <std::size_t N>
18 TEST_CONSTEXPR_CXX23 void test_reset_all() {
19 std::bitset<N> v;
20 v.set();
21 v.reset();
22 for (std::size_t i = 0; i < v.size(); ++i)
23 assert(!v[i]);
26 TEST_CONSTEXPR_CXX23 bool test() {
27 test_reset_all<0>();
28 test_reset_all<1>();
29 test_reset_all<31>();
30 test_reset_all<32>();
31 test_reset_all<33>();
32 test_reset_all<63>();
33 test_reset_all<64>();
34 test_reset_all<65>();
35 test_reset_all<1000>();
37 return true;
40 int main(int, char**) {
41 test();
42 #if TEST_STD_VER > 20
43 static_assert(test());
44 #endif
46 return 0;