op_divide=.pass.cpp 1016 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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& operator/=(const rep& rhs);
  11. #include <chrono>
  12. #include <cassert>
  13. #include "test_macros.h"
  14. #include "../../rep.h"
  15. #if TEST_STD_VER > 14
  16. constexpr bool test_constexpr()
  17. {
  18. std::chrono::seconds s(15);
  19. s /= 5;
  20. return s.count() == 3;
  21. }
  22. #endif
  23. int main(int, char**)
  24. {
  25. {
  26. std::chrono::nanoseconds ns(15);
  27. ns /= 5;
  28. assert(ns.count() == 3);
  29. }
  30. #if TEST_STD_VER > 14
  31. static_assert(test_constexpr(), "");
  32. #endif
  33. #if TEST_STD_VER >= 11
  34. { // This is PR#41130
  35. std::chrono::nanoseconds d(5);
  36. NotARep n;
  37. d /= n;
  38. assert(d.count() == 5);
  39. }
  40. #endif
  41. return 0;
  42. }