blob: 59dc62fce17d5239475002b1e49448bc8ed02324 [file] [log] [blame]
Eric Fiseliera9e65962016-10-12 07:46:20 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Eric Fiseliera9e65962016-10-12 07:46:20 +00006//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++98, c++03, c++11, c++14
10// <optional>
11
12// template <class T> constexpr bool operator>(const optional<T>& x, nullopt_t) noexcept;
13// template <class T> constexpr bool operator>(nullopt_t, const optional<T>& x) noexcept;
14
15#include <optional>
16
JF Bastien2df59c52019-02-04 20:31:13 +000017int main(int, char**)
Eric Fiseliera9e65962016-10-12 07:46:20 +000018{
19 using std::optional;
20 using std::nullopt_t;
21 using std::nullopt;
22
23 {
24 typedef int T;
25 typedef optional<T> O;
26
27 constexpr O o1; // disengaged
28 constexpr O o2{1}; // engaged
29
30 static_assert ( !(nullopt > o1), "" );
31 static_assert ( !(nullopt > o2), "" );
32 static_assert ( !(o1 > nullopt), "" );
33 static_assert ( (o2 > nullopt), "" );
34
35 static_assert (noexcept(nullopt > o1), "");
36 static_assert (noexcept(o1 > nullopt), "");
37 }
JF Bastien2df59c52019-02-04 20:31:13 +000038
39 return 0;
Eric Fiseliera9e65962016-10-12 07:46:20 +000040}