non_implicit_convertible_duration_fail.cpp 942 B

123456789101112131415161718192021222324252627
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // Adaptation to Boost of the libcxx
  10. // Copyright 2010 Vicente J. Botet Escriba
  11. // Distributed under the Boost Software License, Version 1.0.
  12. // See http://www.boost.org/LICENSE_1_0.txt
  13. // Duration2 shall be implicitly convertible to duration.
  14. #include <boost/chrono/chrono.hpp>
  15. void test()
  16. {
  17. typedef boost::chrono::system_clock Clock;
  18. typedef boost::chrono::milliseconds Duration1;
  19. typedef boost::chrono::microseconds Duration2;
  20. {
  21. boost::chrono::time_point<Clock, Duration2> t2(Duration2(3));
  22. boost::chrono::time_point<Clock, Duration1> t1 = t2;
  23. }
  24. }