xref: /llvm-project/libcxx/test/std/time/time.point/time.point.comparisons/op_less.compile.fail.cpp (revision 7738db2c06b177fe916ac1bcf3633449b3c1fca9)
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 
9 // <chrono>
10 
11 // time_point
12 
13 // template <class Clock, class Duration1, class Duration2>
14 //   bool
15 //   operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
16 
17 // template <class Clock, class Duration1, class Duration2>
18 //   bool
19 //   operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
20 
21 // template <class Clock, class Duration1, class Duration2>
22 //   bool
23 //   operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
24 
25 // template <class Clock, class Duration1, class Duration2>
26 //   bool
27 //   operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
28 
29 // time_points with different clocks should not compare
30 
31 #include <chrono>
32 
33 #include "../../clock.h"
34 
main(int,char **)35 int main(int, char**)
36 {
37     typedef std::chrono::system_clock Clock1;
38     typedef Clock                     Clock2;
39     typedef std::chrono::milliseconds Duration1;
40     typedef std::chrono::microseconds Duration2;
41     typedef std::chrono::time_point<Clock1, Duration1> T1;
42     typedef std::chrono::time_point<Clock2, Duration2> T2;
43 
44     T1 t1(Duration1(3));
45     T2 t2(Duration2(3000));
46     t1 < t2;
47 
48   return 0;
49 }
50