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*2df59c50SJF Bastien int main(int, char**)
18a9e65961SEric Fiselier {
19a9e65961SEric Fiselier     using std::optional;
20a9e65961SEric Fiselier     using std::nullopt_t;
21a9e65961SEric Fiselier     using std::nullopt;
22a9e65961SEric Fiselier 
23a9e65961SEric Fiselier     {
24a9e65961SEric Fiselier     typedef int T;
25a9e65961SEric Fiselier     typedef optional<T> O;
26a9e65961SEric Fiselier 
27a9e65961SEric Fiselier     constexpr O o1;     // disengaged
28a9e65961SEric Fiselier     constexpr O o2{1};  // engaged
29a9e65961SEric Fiselier 
30a9e65961SEric Fiselier     static_assert ( !(nullopt < o1), "" );
31a9e65961SEric Fiselier     static_assert (  (nullopt < o2), "" );
32a9e65961SEric Fiselier     static_assert ( !(o1 < nullopt), "" );
33a9e65961SEric Fiselier     static_assert ( !(o2 < nullopt), "" );
34a9e65961SEric Fiselier 
35a9e65961SEric Fiselier     static_assert (noexcept(nullopt < o1), "");
36a9e65961SEric Fiselier     static_assert (noexcept(o1 < nullopt), "");
37a9e65961SEric Fiselier     }
38*2df59c50SJF Bastien 
39*2df59c50SJF Bastien   return 0;
40a9e65961SEric Fiselier }
41