fix(build): Fix incorrect type conversion (#5037)

It's incorrect to convert between different enum classes using
initialisation.
However, it's OK to convert between different enum classes using the
same underlying type using static_cast.

Signed-off-by: Oleg Girko <ol@infoserver.lv>

Signed-off-by: Oleg Girko <ol@infoserver.lv>
Co-authored-by: Oleg Girko <ol@infoserver.lv>
This commit is contained in:
Oleg Girko 2022-10-09 23:25:09 +01:00 committed by pasta
parent d8991c7f3d
commit 0b162ff599
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -133,10 +133,10 @@ private:
static constexpr std::byte to_byte(const Flag flag) static constexpr std::byte to_byte(const Flag flag)
{ {
return std::byte{flag}; return static_cast<std::byte>(flag);
} }
static constexpr std::byte VERSION_BIT_MASK = std::byte{Flag::VERSION_BIT_0} | std::byte{Flag::VERSION_BIT_1} | std::byte{Flag::VERSION_BIT_2}; static constexpr std::byte VERSION_BIT_MASK = static_cast<std::byte>(Flag::VERSION_BIT_0) | static_cast<std::byte>(Flag::VERSION_BIT_1) | static_cast<std::byte>(Flag::VERSION_BIT_2);
}; };
struct CompressibleBlockHeader : CBlockHeader { struct CompressibleBlockHeader : CBlockHeader {