1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
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 // constexpr strong_ordering operator<=>(monostate, monostate) noexcept { return strong_ordering::equal; } // since C++20
24 #include "test_comparisons.h"
25 #include "test_macros.h"
27 constexpr bool test() {
28 using M
= std::monostate
;
31 assert(testComparisons(m1
, m2
, /*isEqual*/ true, /*isLess*/ false));
32 AssertComparisonsAreNoexcept
<M
>();
35 assert(testOrder(m1
, m2
, std::strong_ordering::equal
));
36 AssertOrderAreNoexcept
<M
>();
37 #endif // TEST_STD_VER > 17
42 int main(int, char**) {
44 static_assert(test());