Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/google/protobuf/message.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,13 @@ class PROTOBUF_EXPORT Message : public MessageLite {
#if !defined(PROTOBUF_CUSTOM_VTABLE)
constexpr Message() {}
#endif // PROTOBUF_CUSTOM_VTABLE

#if defined(PROTOBUF_CUSTOM_VTABLE)
// Explicitly define the destructor as protected so it can't be called
// directly.
~Message() = default;
#endif // PROTOBUF_CUSTOM_VTABLE

using MessageLite::MessageLite;

// Get a struct containing the metadata for the Message, which is used in turn
Expand Down
8 changes: 7 additions & 1 deletion src/google/protobuf/message_lite.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ class PROTOBUF_EXPORT MessageLite {
public:
MessageLite(const MessageLite&) = delete;
MessageLite& operator=(const MessageLite&) = delete;
PROTOBUF_VIRTUAL ~MessageLite() = default;
#if !defined(PROTOBUF_CUSTOM_VTABLE)
virtual ~MessageLite() = default;
#endif // !PROTOBUF_CUSTOM_VTABLE

// Basic Operations ------------------------------------------------

Expand Down Expand Up @@ -784,6 +786,10 @@ class PROTOBUF_EXPORT MessageLite {
const char* ptr, internal::ParseContext* ctx);

protected:
#if defined(PROTOBUF_CUSTOM_VTABLE)
~MessageLite() = default;
#endif

// Message implementations require access to internally visible API.
static constexpr internal::InternalVisibility internal_visibility() {
return internal::InternalVisibility{};
Expand Down
Loading