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
22using std::experimental::propagate_const;
23
24constexpr bool operator>(const X &lhs, const X &rhs) {
25 return lhs.i_ > rhs.i_;
26}
27
28int 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(x3_2 > x1_1, "");
35
36 typedef propagate_const<X> P;
37
38 constexpr P p1_1(1);
39 constexpr P p2_1(1);
40 constexpr P p3_2(2);
41
42 static_assert(!(p1_1 > p2_1), "");
43 static_assert(p3_2 > p1_1, "");
44
45 static_assert(!(p1_1 > x2_1), "");
46 static_assert(p3_2 > x1_1, "");
47
48 static_assert(!(x1_1 > p2_1), "");
49 static_assert(x3_2 > p1_1, "");
50
51 return 0;
52}
53

source code of libcxx/test/std/experimental/utilities/propagate_const/propagate_const.nonmembers/propagate_const.relops/greater_than.pass.cpp