1 // -*- C++ -*-
2 //===----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // UNSUPPORTED: c++03, c++11, c++14
11 
12 // <variant>
13 
14 // constexpr bool operator<(monostate, monostate) noexcept { return false; }
15 // constexpr bool operator>(monostate, monostate) noexcept { return false; }
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 true; }
19 // constexpr bool operator!=(monostate, monostate) noexcept { return false; }
20 
21 #include "test_macros.h"
22 #include <cassert>
23 #include <type_traits>
24 #include <variant>
25 
main(int,char **)26 int main(int, char**) {
27   using M = std::monostate;
28   constexpr M m1{};
29   constexpr M m2{};
30   {
31     static_assert((m1 < m2) == false, "");
32     ASSERT_NOEXCEPT(m1 < m2);
33   }
34   {
35     static_assert((m1 > m2) == false, "");
36     ASSERT_NOEXCEPT(m1 > m2);
37   }
38   {
39     static_assert((m1 <= m2) == true, "");
40     ASSERT_NOEXCEPT(m1 <= m2);
41   }
42   {
43     static_assert((m1 >= m2) == true, "");
44     ASSERT_NOEXCEPT(m1 >= m2);
45   }
46   {
47     static_assert((m1 == m2) == true, "");
48     ASSERT_NOEXCEPT(m1 == m2);
49   }
50   {
51     static_assert((m1 != m2) == false, "");
52     ASSERT_NOEXCEPT(m1 != m2);
53   }
54 
55   return 0;
56 }
57