diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h index d73b53c79f7c..21993b361c51 100644 --- a/src/google/protobuf/arena.h +++ b/src/google/protobuf/arena.h @@ -338,7 +338,7 @@ class PROTOBUF_EXPORT 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 1394ab1440ef..94770a41a5cd 100644 --- a/src/google/protobuf/generated_message_table_driven.h +++ b/src/google/protobuf/generated_message_table_driven.h @@ -206,12 +206,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 8cf177be46e7..358d12e6d309 100644 --- a/src/google/protobuf/generated_message_table_driven_lite.h +++ b/src/google/protobuf/generated_message_table_driven_lite.h @@ -101,7 +101,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) || std::is_same::value, "Do not assign"); @@ -119,7 +119,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; } @@ -141,7 +141,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 f0ee5e6a05d9..73fcc74b3a02 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -374,7 +374,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); };