SerializationTraits: Remove unnecessary 2nd template parameter (#31363)

pull/31294/head^2
Yash Tibrewal 2 years ago committed by GitHub
parent 2ebd03d9e2
commit 2c98fe0119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      include/grpcpp/impl/codegen/call_op_set.h
  2. 4
      test/cpp/util/byte_buffer_test.cc

@ -384,11 +384,7 @@ Status CallOpSendMessage::SendMessage(const M& message, WriteOptions options) {
write_options_ = options;
// Serialize immediately since we do not have access to the message pointer
bool own_buf;
// TODO(vjpai): Remove the void below when possible
// The void in the template parameter below should not be needed
// (since it should be implicit) but is needed due to an observed
// difference in behavior between clang and gcc for certain internal users
Status result = SerializationTraits<M, void>::Serialize(
Status result = SerializationTraits<M>::Serialize(
message, send_buf_.bbuf_ptr(), &own_buf);
if (!own_buf) {
send_buf_.Duplicate();
@ -413,7 +409,7 @@ Status CallOpSendMessage::SendMessagePtr(const M* message,
// The void in the template parameter below should not be needed
// (since it should be implicit) but is needed due to an observed
// difference in behavior between clang and gcc for certain internal users
Status result = SerializationTraits<M, void>::Serialize(
Status result = SerializationTraits<M>::Serialize(
*static_cast<const M*>(message), send_buf_.bbuf_ptr(), &own_buf);
if (!own_buf) {
send_buf_.Duplicate();

@ -116,8 +116,8 @@ TEST_F(ByteBufferTest, SerializationMakesCopy) {
bool owned = false;
ByteBuffer buffer(&slices[0], 2);
slices.clear();
auto status = SerializationTraits<ByteBuffer, void>::Serialize(
buffer, &send_buffer, &owned);
auto status =
SerializationTraits<ByteBuffer>::Serialize(buffer, &send_buffer, &owned);
EXPECT_TRUE(status.ok());
EXPECT_TRUE(owned);
EXPECT_TRUE(send_buffer.Valid());

Loading…
Cancel
Save