1ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//>=---------------------------------------------------------------------->=//
2ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//
3ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//                     The LLVM Compiler Infrastructure
4ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//
5ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// This file is dual licensed under the MIT and the University of Illinois Open
6ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// Source Licenses. See LICENSE.TXT for details.
7ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//
8ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe//>=---------------------------------------------------------------------->=//
9ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
10ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// UNSUPPORTED: c++98, c++03, c++11
11ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
12ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// <propagate_const>
13ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
14ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// template <class T> constexpr bool operator>(const propagate_const<T>& x, const propagate_const<T>& y);
15ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// template <class T> constexpr bool operator>(const T& x, const propagate_const<T>& y);
16ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe// template <class T> constexpr bool operator>(const propagate_const<T>& x, const T& y);
17ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
18ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe#include <experimental/propagate_const>
19ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe#include "propagate_const_helpers.h"
20ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe#include <cassert>
21ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
22ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coeusing std::experimental::propagate_const;
23ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
24ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coeconstexpr bool operator>(const X &lhs, const X &rhs) {
25ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  return lhs.i_ > rhs.i_;
26ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe}
27ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
28ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coeint main() {
29ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr X x1_1(1);
30ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr X x2_1(1);
31ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr X x3_2(2);
32ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
33ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(!(x1_1 > x2_1), "");
34ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(x3_2 > x1_1, "");
35ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
36ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  typedef propagate_const<X> P;
37ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
38ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr P p1_1(1);
39ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr P p2_1(1);
40ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  constexpr P p3_2(2);
41ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
42ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(!(p1_1 > p2_1), "");
43ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(p3_2 > p1_1, "");
44ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
45ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(!(p1_1 > x2_1), "");
46ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(p3_2 > x1_1, "");
47ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe
48ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(!(x1_1 > p2_1), "");
49ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe  static_assert(x3_2 > p1_1, "");
50ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe}
51