mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 05:24:13 +00:00
Removed unnecessary check for Offset in AssertScalarT()
This will avoid it accidentally accepting structs of size 4. Change-Id: I251285ae1e4bffb859367dcf89562741a3980bba Tested: on Linux.
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user