IVGCVSW-4599 ArmNN Compile Error when compiled against gcc 9
* Use default keyword for armnn::Optional assignment.
* Use default keyword for BFloat16 copy constructor and assignment.
* Remove unnecessary const from static_cast template argument which
was giving ignored-qualifiers warning.
Signed-off-by: Francis Murtagh <francis.murtagh@arm.com>
Change-Id: Ie3f4ce0a0c199a578d8cca2fea8f5dcef63dba4d
diff --git a/include/armnn/Optional.hpp b/include/armnn/Optional.hpp
index 6771526..1b61e20 100644
--- a/include/armnn/Optional.hpp
+++ b/include/armnn/Optional.hpp
@@ -274,6 +274,7 @@
Optional() noexcept : BaseSwitch{} {}
Optional(const T& value) : BaseSwitch{value} {}
+ Optional& operator=(const Optional& other) = default;
Optional(EmptyOptional empty) : BaseSwitch{empty} {}
Optional(const Optional& other) : BaseSwitch{other} {}
Optional(const BaseSwitch& other) : BaseSwitch{other} {}
diff --git a/src/armnnUtils/BFloat16.hpp b/src/armnnUtils/BFloat16.hpp
index 16ceb52..52344db 100644
--- a/src/armnnUtils/BFloat16.hpp
+++ b/src/armnnUtils/BFloat16.hpp
@@ -18,6 +18,8 @@
: m_Value(0)
{}
+ BFloat16(const BFloat16& v) = default;
+
explicit BFloat16(uint16_t v)
: m_Value(v)
{}
@@ -32,11 +34,7 @@
return ToFloat32();
}
- BFloat16& operator=(const BFloat16& other)
- {
- m_Value = other.Val();
- return *this;
- }
+ BFloat16& operator=(const BFloat16& other) = default;
BFloat16& operator=(float v)
{
@@ -74,7 +72,7 @@
// Mark the LSB
const uint16_t lsb = u16 & 0x0001;
// Mark the error to be truncate (the rest of 16 bits of FP32)
- const uint16_t error = static_cast<const uint16_t>((*u32 & 0x0000FFFF));
+ const uint16_t error = static_cast<uint16_t>((*u32 & 0x0000FFFF));
if ((error > 0x8000 || (error == 0x8000 && lsb == 1)))
{
u16++;
@@ -86,7 +84,7 @@
float ToFloat32() const
{
- const uint32_t u32 = static_cast<const uint32_t>(m_Value << 16u);
+ const uint32_t u32 = static_cast<uint32_t>(m_Value << 16u);
const float* f32 = reinterpret_cast<const float*>(&u32);
return *f32;
}