From 994e08e22a41d29c79ae0f7e133bcdab88d43311 Mon Sep 17 00:00:00 2001 From: Martijn Vels Date: Wed, 12 Jul 2023 11:14:04 -0700 Subject: [PATCH] Explicitly delete the destructor for the internal `Rep` structure. MSVC compilers generate warnings that the default destructor is implicitly deleted, which causes errors on /W1. While this is a pedantic warning (error), we can easily make the deletion explicit to avoid these warnings. PiperOrigin-RevId: 547548886 --- src/google/protobuf/repeated_field.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h index ae04c20942..8879be58c5 100644 --- a/src/google/protobuf/repeated_field.h +++ b/src/google/protobuf/repeated_field.h @@ -459,6 +459,9 @@ class RepeatedField final Element unused; }; Element* elements() { return reinterpret_cast(this + 1); } + + // Avoid 'implicitly deleted dtor' warnings on certain compilers. + ~Rep() = delete; }; static PROTOBUF_CONSTEXPR const size_t kRepHeaderSize = sizeof(Rep);