1a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 2a9e65961SEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6a9e65961SEric Fiselier // 7a9e65961SEric Fiselier //===----------------------------------------------------------------------===// 8a9e65961SEric Fiselier 9a9e65961SEric Fiselier // UNSUPPORTED: c++98, c++03, c++11, c++14 10a9e65961SEric Fiselier // <optional> 11a9e65961SEric Fiselier 12a9e65961SEric Fiselier // template <class T> constexpr bool operator<(const optional<T>& x, nullopt_t) noexcept; 13a9e65961SEric Fiselier // template <class T> constexpr bool operator<(nullopt_t, const optional<T>& x) noexcept; 14a9e65961SEric Fiselier 15a9e65961SEric Fiselier #include <optional> 16a9e65961SEric Fiselier 17*7fc6a556SMarshall Clow #include "test_macros.h" 18*7fc6a556SMarshall Clow 192df59c50SJF Bastien int main(int, char**) 20a9e65961SEric Fiselier { 21a9e65961SEric Fiselier using std::optional; 22a9e65961SEric Fiselier using std::nullopt_t; 23a9e65961SEric Fiselier using std::nullopt; 24a9e65961SEric Fiselier 25a9e65961SEric Fiselier { 26a9e65961SEric Fiselier typedef int T; 27a9e65961SEric Fiselier typedef optional<T> O; 28a9e65961SEric Fiselier 29a9e65961SEric Fiselier constexpr O o1; // disengaged 30a9e65961SEric Fiselier constexpr O o2{1}; // engaged 31a9e65961SEric Fiselier 32a9e65961SEric Fiselier static_assert ( !(nullopt < o1), "" ); 33a9e65961SEric Fiselier static_assert ( (nullopt < o2), "" ); 34a9e65961SEric Fiselier static_assert ( !(o1 < nullopt), "" ); 35a9e65961SEric Fiselier static_assert ( !(o2 < nullopt), "" ); 36a9e65961SEric Fiselier 37a9e65961SEric Fiselier static_assert (noexcept(nullopt < o1), ""); 38a9e65961SEric Fiselier static_assert (noexcept(o1 < nullopt), ""); 39a9e65961SEric Fiselier } 402df59c50SJF Bastien 412df59c50SJF Bastien return 0; 42a9e65961SEric Fiselier } 43