diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index bf8f0eea7843..2b8782a422e2 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -335,7 +335,7 @@ class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { template PROTOBUF_ALWAYS_INLINE static T* CreateArray(Arena* arena, size_t num_elements) { - static_assert(std::is_pod::value, + static_assert(std::is_standard_layout::value && std::is_trivial::value, "CreateArray requires a trivially constructible type"); static_assert(std::is_trivially_destructible::value, "CreateArray requires a trivially destructible type"); diff --git a/src/google/protobuf/generated_message_table_driven.h b/src/google/protobuf/generated_message_table_driven.h index 731d6c521239..68d80dcc89b1 100644 --- a/src/google/protobuf/generated_message_table_driven.h +++ b/src/google/protobuf/generated_message_table_driven.h @@ -203,12 +203,18 @@ struct ParseTable { static_assert(sizeof(ParseTableField) <= 16, "ParseTableField is too large"); // The tables must be composed of POD components to ensure link-time // initialization. -static_assert(std::is_pod::value, ""); -static_assert(std::is_pod::value, ""); -static_assert(std::is_pod::value, ""); -static_assert(std::is_pod::value, ""); -static_assert(std::is_pod::value, ""); -static_assert(std::is_pod::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); +static_assert(std::is_standard_layout::value, ""); +static_assert(std::is_trivial::value, ""); // TODO(ckennelly): Consolidate these implementations into a single one, using // dynamic dispatch to the appropriate unknown field handler. diff --git a/src/google/protobuf/generated_message_table_driven_lite.h b/src/google/protobuf/generated_message_table_driven_lite.h index 6813d18bdf42..9fc910a01e97 100644 --- a/src/google/protobuf/generated_message_table_driven_lite.h +++ b/src/google/protobuf/generated_message_table_driven_lite.h @@ -87,7 +87,7 @@ inline ExtensionSet* GetExtensionSet(MessageLite* msg, int64 extension_offset) { template inline Type* AddField(MessageLite* msg, int64 offset) { - static_assert(std::is_pod::value, + static_assert(std::is_standard_layout::value && std::is_trivial::value, "Do not assign"); RepeatedField* repeated = Raw>(msg, offset); @@ -104,7 +104,7 @@ inline std::string* AddField(MessageLite* msg, int64 offset) { template inline void AddField(MessageLite* msg, int64 offset, Type value) { - static_assert(std::is_pod::value, + static_assert(std::is_standard_layout::value && std::is_trivial::value, "Do not assign"); *AddField(msg, offset) = value; } @@ -126,7 +126,7 @@ inline Type* MutableField(MessageLite* msg, uint32* has_bits, template inline void SetField(MessageLite* msg, uint32* has_bits, uint32 has_bit_index, int64 offset, Type value) { - static_assert(std::is_pod::value, + static_assert(std::is_standard_layout::value && std::is_trivial::value, "Do not assign"); *MutableField(msg, has_bits, has_bit_index, offset) = value; } diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index b9ea50dc8217..89f1474603cf 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -501,7 +501,7 @@ namespace internal { // effectively. template ::value> + std::is_standard_layout::value && std::is_trivial::value> struct ElementCopier { void operator()(Element* to, const Element* from, int array_size); };