From 0b162ff59940ceb93025c6178469ca1e732a7fcf Mon Sep 17 00:00:00 2001
From: Oleg Girko
Date: Sun, 9 Oct 2022 23:25:09 +0100
Subject: [PATCH] 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
Signed-off-by: Oleg Girko
Co-authored-by: Oleg Girko
---
src/primitives/block.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/primitives/block.h b/src/primitives/block.h
index 3ee843f8f9..1fcb2ee853 100644
--- a/src/primitives/block.h
+++ b/src/primitives/block.h
@@ -133,10 +133,10 @@ private:
static constexpr std::byte to_byte(const Flag flag)
{
- return std::byte{flag};
+ return static_cast(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(Flag::VERSION_BIT_0) | static_cast(Flag::VERSION_BIT_1) | static_cast(Flag::VERSION_BIT_2);
};
struct CompressibleBlockHeader : CBlockHeader {