diff --git a/src/flags.hh b/src/flags.hh index 7b05b5a5..6b701016 100644 --- a/src/flags.hh +++ b/src/flags.hh @@ -27,7 +27,7 @@ constexpr Flags operator|(Flags lhs, Flags rhs) } template> -Flags& operator|=(Flags& lhs, Flags rhs) +constexpr Flags& operator|=(Flags& lhs, Flags rhs) { (UnderlyingType&) lhs |= (UnderlyingType) rhs; return lhs; @@ -41,8 +41,8 @@ struct TestableFlags constexpr operator Flags() const { return value; } constexpr operator UnderlyingType() const { return (UnderlyingType)value; } - bool operator==(const TestableFlags& other) const { return value == other.value; } - bool operator!=(const TestableFlags& other) const { return value != other.value; } + constexpr bool operator==(const TestableFlags& other) const { return value == other.value; } + constexpr bool operator!=(const TestableFlags& other) const { return value != other.value; } }; template> @@ -52,7 +52,7 @@ constexpr TestableFlags operator&(Flags lhs, Flags rhs) } template> -Flags& operator&=(Flags& lhs, Flags rhs) +constexpr Flags& operator&=(Flags& lhs, Flags rhs) { (UnderlyingType&) lhs &= (UnderlyingType) rhs; return lhs; @@ -71,7 +71,7 @@ constexpr Flags operator^(Flags lhs, Flags rhs) } template> -Flags& operator^=(Flags& lhs, Flags rhs) +constexpr Flags& operator^=(Flags& lhs, Flags rhs) { (UnderlyingType&) lhs ^= (UnderlyingType) rhs; return lhs;