zero.pass.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. // <chrono>
  9. // duration_values::zero // noexcept after C++17
  10. #include <chrono>
  11. #include <cassert>
  12. #include "test_macros.h"
  13. #include "../../rep.h"
  14. int main(int, char**)
  15. {
  16. assert(std::chrono::duration_values<int>::zero() == 0);
  17. assert(std::chrono::duration_values<Rep>::zero() == 0);
  18. #if TEST_STD_VER >= 11
  19. static_assert(std::chrono::duration_values<int>::zero() == 0, "");
  20. static_assert(std::chrono::duration_values<Rep>::zero() == 0, "");
  21. #endif
  22. LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero());
  23. LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero());
  24. #if TEST_STD_VER > 17
  25. ASSERT_NOEXCEPT(std::chrono::duration_values<int>::zero());
  26. ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::zero());
  27. #endif
  28. return 0;
  29. }