1*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===// 2*4684ddb6SLionel Sambuc // 3*4684ddb6SLionel Sambuc // The LLVM Compiler Infrastructure 4*4684ddb6SLionel Sambuc // 5*4684ddb6SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open 6*4684ddb6SLionel Sambuc // Source Licenses. See LICENSE.TXT for details. 7*4684ddb6SLionel Sambuc // 8*4684ddb6SLionel Sambuc //===----------------------------------------------------------------------===// 9*4684ddb6SLionel Sambuc 10*4684ddb6SLionel Sambuc 11*4684ddb6SLionel Sambuc // <optional> 12*4684ddb6SLionel Sambuc 13*4684ddb6SLionel Sambuc // template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept; 14*4684ddb6SLionel Sambuc // template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept; 15*4684ddb6SLionel Sambuc 16*4684ddb6SLionel Sambuc #include <experimental/optional> 17*4684ddb6SLionel Sambuc main()18*4684ddb6SLionel Sambucint main() 19*4684ddb6SLionel Sambuc { 20*4684ddb6SLionel Sambuc #if _LIBCPP_STD_VER > 11 21*4684ddb6SLionel Sambuc using std::experimental::optional; 22*4684ddb6SLionel Sambuc using std::experimental::nullopt_t; 23*4684ddb6SLionel Sambuc using std::experimental::nullopt; 24*4684ddb6SLionel Sambuc 25*4684ddb6SLionel Sambuc { 26*4684ddb6SLionel Sambuc typedef int T; 27*4684ddb6SLionel Sambuc typedef optional<T> O; 28*4684ddb6SLionel Sambuc 29*4684ddb6SLionel Sambuc constexpr O o1; // disengaged 30*4684ddb6SLionel Sambuc constexpr O o2{1}; // engaged 31*4684ddb6SLionel Sambuc 32*4684ddb6SLionel Sambuc static_assert ( nullopt == o1 , "" ); 33*4684ddb6SLionel Sambuc static_assert ( !(nullopt == o2), "" ); 34*4684ddb6SLionel Sambuc static_assert ( o1 == nullopt , "" ); 35*4684ddb6SLionel Sambuc static_assert ( !(o2 == nullopt), "" ); 36*4684ddb6SLionel Sambuc 37*4684ddb6SLionel Sambuc static_assert (noexcept(nullopt == o1), ""); 38*4684ddb6SLionel Sambuc static_assert (noexcept(o1 == nullopt), ""); 39*4684ddb6SLionel Sambuc } 40*4684ddb6SLionel Sambuc #endif 41*4684ddb6SLionel Sambuc } 42