blob: bfc8e16e36a17c942a5383ad8fb4acc5df344c0d [file] [log] [blame]
Howard Hinnante7d746d2013-09-02 20:30:37 +00001//===----------------------------------------------------------------------===//
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
11// <optional>
12
13// template <class T> constexpr bool operator==(const optional<T>& x, nullopt_t) noexcept;
14// template <class T> constexpr bool operator==(nullopt_t, const optional<T>& x) noexcept;
15
16#include <optional>
17
18int main()
19{
20#if _LIBCPP_STD_VER > 11
21 {
22 typedef int T;
23 typedef std::optional<T> O;
24
25 constexpr O o1; // disengaged
26 constexpr O o2{1}; // engaged
27
28 static_assert ( std::nullopt == o1 , "" );
29 static_assert ( !(std::nullopt == o2), "" );
30 static_assert ( o1 == std::nullopt , "" );
31 static_assert ( !(o2 == std::nullopt), "" );
32
33 static_assert (noexcept(std::nullopt == o1), "");
34 static_assert (noexcept(o1 == std::nullopt), "");
35 }
36#endif
37}