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
pull/16182/head
Thomas Köppe 9 months ago committed by Copybara-Service
parent 88e0495a78
commit 57f3065459
  1. 8
      src/google/protobuf/generated_message_reflection.cc
  2. 8
      src/google/protobuf/message.h

@ -1168,6 +1168,14 @@ void Reflection::SwapFieldsImpl(
} }
} }
template void Reflection::SwapFieldsImpl<true>(
Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const;
template void Reflection::SwapFieldsImpl<false>(
Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const;
void Reflection::SwapFields( void Reflection::SwapFields(
Message* message1, Message* message2, Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const { const std::vector<const FieldDescriptor*>& fields) const {

@ -1308,6 +1308,14 @@ class PROTOBUF_EXPORT Reflection final {
internal::ParseContext* ctx); internal::ParseContext* ctx);
}; };
extern template void Reflection::SwapFieldsImpl<true>(
Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const;
extern template void Reflection::SwapFieldsImpl<false>(
Message* message1, Message* message2,
const std::vector<const FieldDescriptor*>& fields) const;
// Abstract interface for a factory for message objects. // Abstract interface for a factory for message objects.
// //
// The thread safety for this class is implementation dependent, see comments // The thread safety for this class is implementation dependent, see comments

Loading…
Cancel
Save