greater_equal.pass.cpp revision ee49613ff465e6f7627ec6d70b8930e9a3f72423
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(!(x1_1 >= x3_2), ""); 35ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(x3_2 >= x1_1, ""); 36ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe 37ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe typedef propagate_const<X> P; 38ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe 39ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe constexpr P p1_1(1); 40ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe constexpr P p2_1(1); 41ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe constexpr P p3_2(2); 42ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe 43ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(p1_1 >= p2_1, ""); 44ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(!(p1_1 >= p3_2), ""); 45ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(p3_2 >= p1_1, ""); 46ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe 47ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(p1_1 >= x2_1, ""); 48ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(!(p1_1 >= x3_2), ""); 49ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(p3_2 >= x1_1, ""); 50ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe 51ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(x1_1 >= p2_1, ""); 52ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(!(x1_1 >= p3_2), ""); 53ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe static_assert(x3_2 >= p1_1, ""); 54ee49613ff465e6f7627ec6d70b8930e9a3f72423Jonathan Coe} 55