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 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03, c++11, c++14
10 
11 // <variant>
12 
13 // constexpr bool operator<(monostate, monostate) noexcept { return false; }
14 // constexpr bool operator>(monostate, monostate) noexcept { return false; }
15 // constexpr bool operator<=(monostate, monostate) noexcept { return true; }
16 // constexpr bool operator>=(monostate, monostate) noexcept { return true; }
17 // constexpr bool operator==(monostate, monostate) noexcept { return true; }
18 // constexpr bool operator!=(monostate, monostate) noexcept { return false; }
19 
20 #include "test_macros.h"
21 #include <cassert>
22 #include <type_traits>
23 #include <variant>
24 
main(int,char **)25 int main(int, char**) {
26   using M = std::monostate;
27   constexpr M m1{};
28   constexpr M m2{};
29   {
30     static_assert((m1 < m2) == false, "");
31     ASSERT_NOEXCEPT(m1 < m2);
32   }
33   {
34     static_assert((m1 > m2) == false, "");
35     ASSERT_NOEXCEPT(m1 > m2);
36   }
37   {
38     static_assert((m1 <= m2) == true, "");
39     ASSERT_NOEXCEPT(m1 <= m2);
40   }
41   {
42     static_assert((m1 >= m2) == true, "");
43     ASSERT_NOEXCEPT(m1 >= m2);
44   }
45   {
46     static_assert((m1 == m2) == true, "");
47     ASSERT_NOEXCEPT(m1 == m2);
48   }
49   {
50     static_assert((m1 != m2) == false, "");
51     ASSERT_NOEXCEPT(m1 != m2);
52   }
53 
54   return 0;
55 }
56