• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // test default ctor
11 
12 #include <bitset>
13 #include <cassert>
14 
15 #include "test_macros.h"
16 
17 #if defined(TEST_COMPILER_C1XX)
18 #pragma warning(disable: 6294) // Ill-defined for-loop:  initial condition does not satisfy test.  Loop body not executed.
19 #endif
20 
21 template <std::size_t N>
test_default_ctor()22 void test_default_ctor()
23 {
24     {
25         TEST_CONSTEXPR std::bitset<N> v1;
26         assert(v1.size() == N);
27         for (std::size_t i = 0; i < N; ++i)
28             assert(v1[i] == false);
29     }
30 #if TEST_STD_VER >= 11
31     {
32         constexpr std::bitset<N> v1;
33         static_assert(v1.size() == N, "");
34     }
35 #endif
36 }
37 
38 
main()39 int main()
40 {
41     test_default_ctor<0>();
42     test_default_ctor<1>();
43     test_default_ctor<31>();
44     test_default_ctor<32>();
45     test_default_ctor<33>();
46     test_default_ctor<63>();
47     test_default_ctor<64>();
48     test_default_ctor<65>();
49     test_default_ctor<1000>();
50 }
51