From 57f30654593160be2415ca658542e30b50f85e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6ppe?= Date: Fri, 15 Mar 2024 18:20:44 -0700 Subject: [PATCH] Declare and define explicit template instantiations, since the required specializations are needed at a point where the primary template is not defined. PiperOrigin-RevId: 616297036 --- src/google/protobuf/generated_message_reflection.cc | 8 ++++++++ src/google/protobuf/message.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc index 436856f57c..052f9d7417 100644 --- a/src/google/protobuf/generated_message_reflection.cc +++ b/src/google/protobuf/generated_message_reflection.cc @@ -1168,6 +1168,14 @@ void Reflection::SwapFieldsImpl( } } +template void Reflection::SwapFieldsImpl( + Message* message1, Message* message2, + const std::vector& fields) const; + +template void Reflection::SwapFieldsImpl( + Message* message1, Message* message2, + const std::vector& fields) const; + void Reflection::SwapFields( Message* message1, Message* message2, const std::vector& fields) const { diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h index 0ce0218df9..fb0643c3d8 100644 --- a/src/google/protobuf/message.h +++ b/src/google/protobuf/message.h @@ -1308,6 +1308,14 @@ class PROTOBUF_EXPORT Reflection final { internal::ParseContext* ctx); }; +extern template void Reflection::SwapFieldsImpl( + Message* message1, Message* message2, + const std::vector& fields) const; + +extern template void Reflection::SwapFieldsImpl( + Message* message1, Message* message2, + const std::vector& fields) const; + // Abstract interface for a factory for message objects. // // The thread safety for this class is implementation dependent, see comments