xref: /llvm-project/libcxx/test/std/utilities/optional/optional.nullops/greater_equal.pass.cpp (revision 31cbe0f240f660f15602c96b787c58a26f17e179)
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 
9*31cbe0f2SLouis Dionne // UNSUPPORTED: 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 
177fc6a556SMarshall Clow #include "test_macros.h"
187fc6a556SMarshall Clow 
main(int,char **)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