Skip to content

[CORE][GEN][ZH] Add missing virtual destructors for virtual classes #1049

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Caball009
Copy link

@Caball009 Caball009 commented Jun 11, 2025

Some virtual classes have no virtual destructor, which leads to compiler warnings when an object of such a class is manually deleted:
delete called on non-final 'Class' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
destructor called on non-final 'Class' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]

If it helps with the review process, I could provide a list with class name + filename + line number where the delete happens / the compiler warnings originate. I can also provide that in the form of an url.

@Caball009
Copy link
Author

Caball009 commented Jun 11, 2025

I noticed more classes with virtual functions but without virtual destructor. I assume no instances of such classes are manually deleted, so the compiler may not issue a warning for it.

@aliendroid1
Copy link

Some virtual classes have no virtual destructor, which leads to compiler warnings when an object of such a class is manually deleted: delete called on non-final 'Class' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor] destructor called on non-final 'Class' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]

If it helps with the review process, I could provide a list with class name + filename + line number where the delete happens / the compiler warnings originate. I can also provide that in the form of an url.

did you make sure that a virtual destructor was needed and that it wouldn't just be better to make the base destructor non-virtual?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants