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 10// UNSUPPORTED: c++98, c++03, c++11 11 12// <propagate_const> 13 14// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const propagate_const<T>& y); 15// template <class T> constexpr bool operator<=(const T& x, const propagate_const<T>& y); 16// template <class T> constexpr bool operator<=(const propagate_const<T>& x, const T& y); 17 18#include <experimental/propagate_const> 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() { 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} 56