diff --git a/lib/source/pl/core/token.cpp b/lib/source/pl/core/token.cpp index 2c8486cd..b0070d43 100644 --- a/lib/source/pl/core/token.cpp +++ b/lib/source/pl/core/token.cpp @@ -136,14 +136,26 @@ namespace pl::core { } }, [](pl::integral auto lhs, pl::floating_point auto rhs) -> std::strong_ordering { - if (lhs == rhs) return std::strong_ordering::equal; - if (lhs < rhs) return std::strong_ordering::less; - return std::strong_ordering::greater; + if constexpr (std::same_as || std::same_as) + return char(lhs) <=> char(rhs); + else if constexpr (std::same_as || std::same_as) + return bool(lhs) <=> bool(rhs); + else { + if (lhs == rhs) return std::strong_ordering::equal; + if (lhs < rhs) return std::strong_ordering::less; + return std::strong_ordering::greater; + } }, [](pl::floating_point auto lhs, pl::integral auto rhs) -> std::strong_ordering { - if (lhs == rhs) return std::strong_ordering::equal; - if (lhs < rhs) return std::strong_ordering::less; - return std::strong_ordering::greater; + if constexpr (std::same_as || std::same_as) + return char(lhs) <=> char(rhs); + else if constexpr (std::same_as || std::same_as) + return bool(lhs) <=> bool(rhs); + else { + if (lhs == rhs) return std::strong_ordering::equal; + if (lhs < rhs) return std::strong_ordering::less; + return std::strong_ordering::greater; + } }, [](auto, auto) -> std::strong_ordering { return std::strong_ordering::less;