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 | // UNSUPPORTED: c++03, c++11 |
10 | |
11 | // <propagate_const> |
12 | |
13 | // template <class T> constexpr bool operator>=(const propagate_const<T>& x, const propagate_const<T>& y); |
14 | // template <class T> constexpr bool operator>=(const T& x, const propagate_const<T>& y); |
15 | // template <class T> constexpr bool operator>=(const propagate_const<T>& x, const T& y); |
16 | |
17 | #include <experimental/propagate_const> |
18 | #include "test_macros.h" |
19 | #include "propagate_const_helpers.h" |
20 | #include <cassert> |
21 | |
22 | using std::experimental::propagate_const; |
23 | |
24 | constexpr bool operator>=(const X &lhs, const X &rhs) { |
25 | return lhs.i_ >= rhs.i_; |
26 | } |
27 | |
28 | int main(int, char**) { |
29 | constexpr X x1_1(1); |
30 | constexpr X x2_1(1); |
31 | constexpr X x3_2(2); |
32 | |
33 | static_assert(x1_1 >= x2_1, "" ); |
34 | static_assert(!(x1_1 >= x3_2), "" ); |
35 | static_assert(x3_2 >= x1_1, "" ); |
36 | |
37 | typedef propagate_const<X> P; |
38 | |
39 | constexpr P p1_1(1); |
40 | constexpr P p2_1(1); |
41 | constexpr P p3_2(2); |
42 | |
43 | static_assert(p1_1 >= p2_1, "" ); |
44 | static_assert(!(p1_1 >= p3_2), "" ); |
45 | static_assert(p3_2 >= p1_1, "" ); |
46 | |
47 | static_assert(p1_1 >= x2_1, "" ); |
48 | static_assert(!(p1_1 >= x3_2), "" ); |
49 | static_assert(p3_2 >= x1_1, "" ); |
50 | |
51 | static_assert(x1_1 >= p2_1, "" ); |
52 | static_assert(!(x1_1 >= p3_2), "" ); |
53 | static_assert(x3_2 >= p1_1, "" ); |
54 | |
55 | return 0; |
56 | } |
57 | |