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 //===----------------------------------------------------------------------===// 8 9 // test default ctor 10 11 #include <bitset> 12 #include <cassert> 13 14 #include "test_macros.h" 15 16 #if defined(TEST_COMPILER_C1XX) 17 #pragma warning(disable: 6294) // Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. 18 #endif 19 20 template <std::size_t N> 21 void test_default_ctor() 22 { 23 { 24 TEST_CONSTEXPR std::bitset<N> v1; 25 assert(v1.size() == N); 26 for (std::size_t i = 0; i < N; ++i) 27 assert(v1[i] == false); 28 } 29 #if TEST_STD_VER >= 11 30 { 31 constexpr std::bitset<N> v1; 32 static_assert(v1.size() == N, ""); 33 } 34 #endif 35 } 36 37 38 int main(int, char**) 39 { 40 test_default_ctor<0>(); 41 test_default_ctor<1>(); 42 test_default_ctor<31>(); 43 test_default_ctor<32>(); 44 test_default_ctor<33>(); 45 test_default_ctor<63>(); 46 test_default_ctor<64>(); 47 test_default_ctor<65>(); 48 test_default_ctor<1000>(); 49 50 return 0; 51 } 52