diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h index d38232462e..7a0c0989fe 100644 --- a/src/google/protobuf/repeated_ptr_field.h +++ b/src/google/protobuf/repeated_ptr_field.h @@ -311,9 +311,7 @@ class PROTOBUF_EXPORT RepeatedPtrFieldBase { // Message creating functor: used in MergeFrom() template static MessageLite* CopyMessage(Arena* arena, const MessageLite& src) { - T* msg = Arena::CreateMaybeMessage(arena); - msg->MergeFrom(static_cast(src)); - return msg; + return Arena::CreateMaybeMessage(arena, static_cast(src)); } // Appends all message values from `from` to this instance.