diff --git a/Userland/Libraries/LibRegex/RegexOptions.h b/Userland/Libraries/LibRegex/RegexOptions.h index 60a1cce1ce..5ad7cab9fc 100644 --- a/Userland/Libraries/LibRegex/RegexOptions.h +++ b/Userland/Libraries/LibRegex/RegexOptions.h @@ -74,13 +74,13 @@ public: RegexOptions() = default; - RegexOptions(T flags) + constexpr RegexOptions(T flags) : m_flags(flags) { } template - RegexOptions(RegexOptions other) + constexpr RegexOptions(RegexOptions other) : m_flags((T) static_cast(other.value())) { } @@ -88,16 +88,16 @@ public: operator bool() const { return !!*this; } bool operator!() const { return (FlagsUnderlyingType)m_flags == 0; } - RegexOptions operator|(T flag) const { return RegexOptions { (T)((FlagsUnderlyingType)m_flags | (FlagsUnderlyingType)flag) }; } - RegexOptions operator&(T flag) const { return RegexOptions { (T)((FlagsUnderlyingType)m_flags & (FlagsUnderlyingType)flag) }; } + constexpr RegexOptions operator|(T flag) const { return RegexOptions { (T)((FlagsUnderlyingType)m_flags | (FlagsUnderlyingType)flag) }; } + constexpr RegexOptions operator&(T flag) const { return RegexOptions { (T)((FlagsUnderlyingType)m_flags & (FlagsUnderlyingType)flag) }; } - RegexOptions& operator|=(T flag) + constexpr RegexOptions& operator|=(T flag) { m_flags = (T)((FlagsUnderlyingType)m_flags | (FlagsUnderlyingType)flag); return *this; } - RegexOptions& operator&=(T flag) + constexpr RegexOptions& operator&=(T flag) { m_flags = (T)((FlagsUnderlyingType)m_flags & (FlagsUnderlyingType)flag); return *this; @@ -114,19 +114,19 @@ private: }; template -inline RegexOptions operator|(T lhs, T rhs) +constexpr RegexOptions operator|(T lhs, T rhs) { return RegexOptions { lhs } |= rhs; } template -inline RegexOptions operator&(T lhs, T rhs) +constexpr RegexOptions operator&(T lhs, T rhs) { return RegexOptions { lhs } &= rhs; } template -inline T operator~(T flag) +constexpr T operator~(T flag) { return (T) ~((FlagsUnderlyingType)flag); }