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
pull/13292/head
Martijn Vels 1 year ago committed by Copybara-Service
parent 4fcd1ddea2
commit 994e08e22a
  1. 3
      src/google/protobuf/repeated_field.h

@ -459,6 +459,9 @@ class RepeatedField final
Element unused; Element unused;
}; };
Element* elements() { return reinterpret_cast<Element*>(this + 1); } Element* elements() { return reinterpret_cast<Element*>(this + 1); }
// Avoid 'implicitly deleted dtor' warnings on certain compilers.
~Rep() = delete;
}; };
static PROTOBUF_CONSTEXPR const size_t kRepHeaderSize = sizeof(Rep); static PROTOBUF_CONSTEXPR const size_t kRepHeaderSize = sizeof(Rep);

Loading…
Cancel
Save