aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-09-20 12:06:55 -0700
committerGravatar Vijay Pai <vpai@google.com>2018-09-20 13:30:20 -0700
commitda1b75b5d5a9e9d437886d324f61241808fe05ab (patch)
tree786c0d1db785dedd1eae5c6f70e6463c22b1324c
parent17fc4d4029e0525e8cb0a25686e078f5842b3644 (diff)
Add a virtual destructor to the new class with virtual methods
-rw-r--r--src/compiler/cpp_generator.cc1
-rw-r--r--test/cpp/codegen/compiler_test_golden2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 0acd211009..56716493dc 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -560,6 +560,7 @@ void PrintHeaderClientMethodCallbackInterfacesStart(
// "Raw" methods since the callback-based API returns unowned raw pointers
printer->Print(" public:\n");
printer->Indent();
+ printer->Print("virtual ~experimental_async_interface() {}\n");
}
void PrintHeaderClientMethodCallbackInterfaces(
diff --git a/test/cpp/codegen/compiler_test_golden b/test/cpp/codegen/compiler_test_golden
index c679880763..93e1e68654 100644
--- a/test/cpp/codegen/compiler_test_golden
+++ b/test/cpp/codegen/compiler_test_golden
@@ -108,6 +108,7 @@ class ServiceA final {
// Method A4 trailing comment 1
class experimental_async_interface {
public:
+ virtual ~experimental_async_interface() {}
// MethodA1 leading comment 1
virtual void MethodA1(::grpc::ClientContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response, std::function<void(::grpc::Status)>) = 0;
// MethodA1 trailing comment 1
@@ -519,6 +520,7 @@ class ServiceB final {
// MethodB1 trailing comment 1
class experimental_async_interface {
public:
+ virtual ~experimental_async_interface() {}
// MethodB1 leading comment 1
virtual void MethodB1(::grpc::ClientContext* context, const ::grpc::testing::Request* request, ::grpc::testing::Response* response, std::function<void(::grpc::Status)>) = 0;
// MethodB1 trailing comment 1