Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 18, 2021
Merged

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

merged 1 commit into from Mar 18, 2021

Conversation

PatriosTheGreat
Copy link
Contributor

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

This warning was introduced by clang-11 compiler.

@@ -1092,7 +1092,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* printer) {

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

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
Member

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.

None yet

3 participants