default.pass.cpp 1.2 KB

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