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