180e66ac1SEric Fiselier //===----------------------------------------------------------------------===//
280e66ac1SEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
680e66ac1SEric Fiselier //
780e66ac1SEric Fiselier //===----------------------------------------------------------------------===//
880e66ac1SEric Fiselier
9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
1080e66ac1SEric Fiselier
1180e66ac1SEric Fiselier // <variant>
1280e66ac1SEric Fiselier
1380e66ac1SEric Fiselier // constexpr bool operator<(monostate, monostate) noexcept { return false; }
1480e66ac1SEric Fiselier // constexpr bool operator>(monostate, monostate) noexcept { return false; }
1580e66ac1SEric Fiselier // constexpr bool operator<=(monostate, monostate) noexcept { return true; }
1680e66ac1SEric Fiselier // constexpr bool operator>=(monostate, monostate) noexcept { return true; }
1780e66ac1SEric Fiselier // constexpr bool operator==(monostate, monostate) noexcept { return true; }
1880e66ac1SEric Fiselier // constexpr bool operator!=(monostate, monostate) noexcept { return false; }
1980e66ac1SEric Fiselier
200d3d8de0SEric Fiselier #include "test_macros.h"
2180e66ac1SEric Fiselier #include <cassert>
2280e66ac1SEric Fiselier #include <type_traits>
2380e66ac1SEric Fiselier #include <variant>
2480e66ac1SEric Fiselier
main(int,char **)252df59c50SJF Bastien int main(int, char**) {
2680e66ac1SEric Fiselier using M = std::monostate;
2780e66ac1SEric Fiselier constexpr M m1{};
2880e66ac1SEric Fiselier constexpr M m2{};
2980e66ac1SEric Fiselier {
3080e66ac1SEric Fiselier static_assert((m1 < m2) == false, "");
310d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 < m2);
3280e66ac1SEric Fiselier }
3380e66ac1SEric Fiselier {
3480e66ac1SEric Fiselier static_assert((m1 > m2) == false, "");
350d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 > m2);
3680e66ac1SEric Fiselier }
3780e66ac1SEric Fiselier {
3880e66ac1SEric Fiselier static_assert((m1 <= m2) == true, "");
390d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 <= m2);
4080e66ac1SEric Fiselier }
4180e66ac1SEric Fiselier {
4280e66ac1SEric Fiselier static_assert((m1 >= m2) == true, "");
430d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 >= m2);
4480e66ac1SEric Fiselier }
4580e66ac1SEric Fiselier {
4680e66ac1SEric Fiselier static_assert((m1 == m2) == true, "");
470d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 == m2);
4880e66ac1SEric Fiselier }
4980e66ac1SEric Fiselier {
5080e66ac1SEric Fiselier static_assert((m1 != m2) == false, "");
510d3d8de0SEric Fiselier ASSERT_NOEXCEPT(m1 != m2);
5280e66ac1SEric Fiselier }
532df59c50SJF Bastien
542df59c50SJF Bastien return 0;
5580e66ac1SEric Fiselier }
56