convert_overflow.pass.cpp 846 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. // template <class Rep2, class Period2>
  11. // duration(const duration<Rep2, Period2>& d);
  12. // overflow should SFINAE instead of error out, LWG 2094
  13. #include <chrono>
  14. #include <cassert>
  15. #include "test_macros.h"
  16. bool called = false;
  17. void f(std::chrono::milliseconds);
  18. void f(std::chrono::seconds)
  19. {
  20. called = true;
  21. }
  22. int main(int, char**)
  23. {
  24. {
  25. std::chrono::duration<int, std::exa> r(1);
  26. f(r);
  27. assert(called);
  28. }
  29. return 0;
  30. }