rep02.pass.cpp 783 B

123456789101112131415161718192021222324252627282930313233
  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
  10. // template <class Rep2>
  11. // explicit duration(const Rep2& r);
  12. // construct double with int
  13. #include <chrono>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. int main(int, char**)
  17. {
  18. std::chrono::duration<double> d(5);
  19. assert(d.count() == 5);
  20. #if TEST_STD_VER >= 11
  21. constexpr std::chrono::duration<double> d2(5);
  22. static_assert(d2.count() == 5, "");
  23. #endif
  24. return 0;
  25. }