blob: a87a87f877fce3afe07ea600985ebdcfefd7abbd [file] [log] [blame]
Eric Fiseliera9e65962016-10-12 07:46:20 +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// UNSUPPORTED: c++98, c++03, c++11, c++14
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 using std::optional;
21 using std::nullopt_t;
22 using std::nullopt;
23
24 {
25 typedef int T;
26 typedef optional<T> O;
27
28 constexpr O o1; // disengaged
29 constexpr O o2{1}; // engaged
30
31 static_assert ( (nullopt == o1), "" );
32 static_assert ( !(nullopt == o2), "" );
33 static_assert ( (o1 == nullopt), "" );
34 static_assert ( !(o2 == nullopt), "" );
35
36 static_assert (noexcept(nullopt == o1), "");
37 static_assert (noexcept(o1 == nullopt), "");
38 }
39}