#include <cassert>
#include <type_traits>
#include <utility>
#include <variant>
#include "test_macros.h"
struct MyBoolExplicit {
bool value;
constexpr explicit MyBoolExplicit(bool v) : value(v) {}
constexpr explicit operator bool() const noexcept { return value; }
};
struct ComparesToMyBoolExplicit {
int value = 0;
};
inline constexpr MyBoolExplicit operator==(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value == RHS.value);
}
inline constexpr MyBoolExplicit operator!=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value != RHS.value);
}
inline constexpr MyBoolExplicit operator<(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value < RHS.value);
}
inline constexpr MyBoolExplicit operator<=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value <= RHS.value);
}
inline constexpr MyBoolExplicit operator>(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value > RHS.value);
}
inline constexpr MyBoolExplicit operator>=(const ComparesToMyBoolExplicit& LHS, const ComparesToMyBoolExplicit& RHS) noexcept {
return MyBoolExplicit(LHS.value >= RHS.value);
}
int main(int, char**) {
using V = std::variant<int, ComparesToMyBoolExplicit>;
V v1(42);
V v2(101);
(void)(v1 == v2);
(void)(v1 != v2);
(void)(v1 < v2);
(void)(v1 <= v2);
(void)(v1 > v2);
(void)(v1 >= v2);
return 0;
}