Removed unnecessary check for Offset in AssertScalarT()

This will avoid it accidentally accepting structs of size 4.

Change-Id: I251285ae1e4bffb859367dcf89562741a3980bba
Tested: on Linux.
parent 9d01bfae
...@@ -820,10 +820,7 @@ FLATBUFFERS_FINAL_CLASS ...@@ -820,10 +820,7 @@ FLATBUFFERS_FINAL_CLASS
template<typename T> void AssertScalarT() { template<typename T> void AssertScalarT() {
#ifndef FLATBUFFERS_CPP98_STL #ifndef FLATBUFFERS_CPP98_STL
// The code assumes power of 2 sizes and endian-swap-ability. // The code assumes power of 2 sizes and endian-swap-ability.
static_assert(std::is_scalar<T>::value static_assert(std::is_scalar<T>::value, "T must be a scalar type");
// The Offset<T> type is essentially a scalar but fails is_scalar.
|| sizeof(T) == sizeof(Offset<void>),
"T must be a scalar type");
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment