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

tidy: check for non-virtual destructors #2498

Merged
merged 1 commit into from
Nov 24, 2023
Merged

tidy: check for non-virtual destructors #2498

merged 1 commit into from
Nov 24, 2023

Conversation

Riolku
Copy link
Collaborator

@Riolku Riolku commented Nov 24, 2023

The check implements this guideline. A base class' destructor should either be public and virtual, meaning that the object can be destroyed through a pointer to the base class (e.g. a unique_ptr), or protected and non-virtual, meaning that the destructor cannot be invoked on a pointer to the base class. Private destructors would mean that children can't invoke the parent destructor, which is undesirable.

The check implements [this guideline][1]. A base class' destructor
should either be public and virtual, meaning that the object can be
destroyed through a pointer to the base class (e.g. a unique_ptr<Base>),
or protected and non-virtual, meaning that the destructor cannot be
invoked on a pointer to the base class. Private destructors would mean
that children can't invoke the parent destructor, which is undesirable.

  [1]: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-virtual
Copy link

codecov bot commented Nov 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6b6a9de) 91.53% compared to head (a816d5e) 91.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2498      +/-   ##
==========================================
- Coverage   91.53%   91.51%   -0.03%     
==========================================
  Files        1026     1026              
  Lines       37906    37909       +3     
==========================================
- Hits        34697    34692       -5     
- Misses       3209     3217       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Riolku Riolku merged commit 170fdf2 into master Nov 24, 2023
13 checks passed
@Riolku Riolku deleted the virtual-destructor branch November 24, 2023 20:54
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.

None yet

2 participants