Commit 616fe05f authored by Adam Cozzette's avatar Adam Cozzette

Removed use of some type traits

Pre-5.1.0 versions of GCC do not support these particular type traits
(see https://github.com/google/protobuf/issues/417).
parent 837c94b8
...@@ -333,7 +333,7 @@ class LIBPROTOBUF_EXPORT Arena { ...@@ -333,7 +333,7 @@ class LIBPROTOBUF_EXPORT Arena {
template <typename T> template <typename T>
GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateArray( GOOGLE_PROTOBUF_ATTRIBUTE_ALWAYS_INLINE static T* CreateArray(
Arena* arena, size_t num_elements) { Arena* arena, size_t num_elements) {
static_assert(std::is_trivially_default_constructible<T>::value, static_assert(std::is_pod<T>::value,
"CreateArray requires a trivially constructible type"); "CreateArray requires a trivially constructible type");
static_assert(std::is_trivially_destructible<T>::value, static_assert(std::is_trivially_destructible<T>::value,
"CreateArray requires a trivially destructible type"); "CreateArray requires a trivially destructible type");
......
...@@ -100,7 +100,7 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) { ...@@ -100,7 +100,7 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) {
template <typename Type> template <typename Type>
inline Type* AddField(MessageLite* msg, int64 offset) { inline Type* AddField(MessageLite* msg, int64 offset) {
static_assert(std::is_trivially_copy_assignable<Type>::value || static_assert(std::is_pod<Type>::value ||
std::is_same<Type, InlinedStringField>::value, std::is_same<Type, InlinedStringField>::value,
"Do not assign"); "Do not assign");
...@@ -119,7 +119,7 @@ inline string* AddField<string>(MessageLite* msg, int64 offset) { ...@@ -119,7 +119,7 @@ inline string* AddField<string>(MessageLite* msg, int64 offset) {
template <typename Type> template <typename Type>
inline void AddField(MessageLite* msg, int64 offset, Type value) { inline void AddField(MessageLite* msg, int64 offset, Type value) {
static_assert(std::is_trivially_copy_assignable<Type>::value, static_assert(std::is_pod<Type>::value,
"Do not assign"); "Do not assign");
*AddField<Type>(msg, offset) = value; *AddField<Type>(msg, offset) = value;
} }
...@@ -141,7 +141,7 @@ inline Type* MutableField(MessageLite* msg, uint32* has_bits, ...@@ -141,7 +141,7 @@ inline Type* MutableField(MessageLite* msg, uint32* has_bits,
template <typename Type> template <typename Type>
inline void SetField(MessageLite* msg, uint32* has_bits, uint32 has_bit_index, inline void SetField(MessageLite* msg, uint32* has_bits, uint32 has_bit_index,
int64 offset, Type value) { int64 offset, Type value) {
static_assert(std::is_trivially_copy_assignable<Type>::value, static_assert(std::is_pod<Type>::value,
"Do not assign"); "Do not assign");
*MutableField<Type>(msg, has_bits, has_bit_index, offset) = value; *MutableField<Type>(msg, has_bits, has_bit_index, offset) = value;
} }
......
...@@ -351,7 +351,7 @@ namespace internal { ...@@ -351,7 +351,7 @@ namespace internal {
// effectively. // effectively.
template <typename Element, template <typename Element,
bool HasTrivialCopy = bool HasTrivialCopy =
std::is_trivially_copy_constructible<Element>::value> std::is_pod<Element>::value>
struct ElementCopier { struct ElementCopier {
void operator()(Element* to, const Element* from, int array_size); void operator()(Element* to, const Element* from, int array_size);
}; };
......
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