[InstCombine][NFC] Precommit a test for folding a binary op of reductions. (#121568)
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.nullops / less_than.pass.cpp
blob190b6328d8322be7b7ecf2f77cc95e173b1991f6
1 //===----------------------------------------------------------------------===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // <optional>
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;
15 #include <optional>
17 #include "test_macros.h"
19 int main(int, char**)
21 using std::optional;
22 using std::nullopt_t;
23 using std::nullopt;
26 typedef int T;
27 typedef optional<T> O;
29 constexpr O o1; // disengaged
30 constexpr O o2{1}; // engaged
32 static_assert ( !(nullopt < o1), "" );
33 static_assert ( (nullopt < o2), "" );
34 static_assert ( !(o1 < nullopt), "" );
35 static_assert ( !(o2 < nullopt), "" );
37 static_assert (noexcept(nullopt < o1), "");
38 static_assert (noexcept(o1 < nullopt), "");
41 return 0;