47 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// bitset<N>& set(); // constexpr since C++2310 11#include <bitset>12#include <cassert>13#include <cstddef>14 15#include "test_macros.h"16 17template <std::size_t N>18TEST_CONSTEXPR_CXX23 void test_set_all() {19 std::bitset<N> v;20 v.set();21 for (std::size_t i = 0; i < v.size(); ++i)22 assert(v[i]);23}24 25TEST_CONSTEXPR_CXX23 bool test() {26 test_set_all<0>();27 test_set_all<1>();28 test_set_all<31>();29 test_set_all<32>();30 test_set_all<33>();31 test_set_all<63>();32 test_set_all<64>();33 test_set_all<65>();34 test_set_all<1000>();35 36 return true;37}38 39int main(int, char**) {40 test();41#if TEST_STD_VER > 2042 static_assert(test());43#endif44 45 return 0;46}47