Skip to content

Fix -Wsuggest-destructor-override for generated C++ proto classes.#8408

Merged
acozzette merged 1 commit intoprotocolbuffers:masterfrom
PatriosTheGreat:master
Mar 18, 2021
Merged

Fix -Wsuggest-destructor-override for generated C++ proto classes.#8408
acozzette merged 1 commit intoprotocolbuffers:masterfrom
PatriosTheGreat:master

Conversation

@PatriosTheGreat
Copy link
Copy Markdown
Contributor

Since proto objects inherits Message class with virtual destructor, they need to override it.

This warning was introduced by clang-11 compiler.

format(
"inline $classname$() : $classname$(nullptr) {}\n"
"virtual ~$classname$();\n"
"virtual ~$classname$() override;\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as long as we're adding override we can drop the virtual keyword since that is implied. One other thing is would you mind running ./generate_descriptor_proto.sh? That will rebuild the checked-in pb.h and pb.cc files.

@acozzette acozzette merged commit f579403 into protocolbuffers:master Mar 18, 2021
@acozzette
Copy link
Copy Markdown

Thanks, @PatriosTheGreat.

bithium pushed a commit to bithium/protobuf that referenced this pull request Sep 4, 2023
Fix -Wsuggest-destructor-override for generated C++ proto classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants