default.pass.cpp 850 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // duration() = default;
  11. // Rep must be default initialized, not initialized with 0
  12. #include <chrono>
  13. #include <cassert>
  14. #include "test_macros.h"
  15. #include "../../rep.h"
  16. template <class D>
  17. void
  18. test()
  19. {
  20. D d;
  21. assert(d.count() == typename D::rep());
  22. #if TEST_STD_VER >= 11
  23. constexpr D d2 = D();
  24. static_assert(d2.count() == typename D::rep(), "");
  25. #endif
  26. }
  27. int main(int, char**)
  28. {
  29. test<std::chrono::duration<Rep> >();
  30. return 0;
  31. }