Bug Description
The compiler emits warnings when a class with a destructor marked final does not have the class itself marked as final. This pattern appears multiple times throughout the codebase, particularly in plugin classes.
Example warning:
warning: class with destructor marked 'final' cannot be inherited from [-Wfinal-dtor-non-final-class]
class Plugin : public Engine::APlugin {
final
...
~Plugin() final = default;
^
note: mark 'Physics::Plugin' as 'final' to silence this warning
Steps to Reproduce
- Compile the project with a modern C++ compiler (Clang, GCC with
-Wfinal-dtor-non-final-class enabled)
- Observe warnings during compilation of plugin files, such as:
src/plugin/physics/src/plugin/PluginPhysics.hpp
- Other plugin classes with the same pattern
Expected Behavior
The project should compile without warnings related to final destructors.
Actual Behavior
Compilation produces multiple warnings about classes with final destructors but non-final class declarations.
Environment
- OS: Cross-platform (Linux, macOS, Windows)
- Compiler: Clang, GCC
- Build System: xmake
Additional Context
The warning indicates an inconsistency: if a destructor is marked final, the class definition should also be marked final to prevent inheritance. This is either:
- A design intent: mark the class as
final to prevent inheritance entirely, or
- Remove
final from the destructor if inheritance should be allowed
The fix requires identifying all affected class definitions and making them consistent.
Related Issues
Bug Description
The compiler emits warnings when a class with a destructor marked
finaldoes not have the class itself marked asfinal. This pattern appears multiple times throughout the codebase, particularly in plugin classes.Example warning:
Steps to Reproduce
-Wfinal-dtor-non-final-classenabled)src/plugin/physics/src/plugin/PluginPhysics.hppExpected Behavior
The project should compile without warnings related to final destructors.
Actual Behavior
Compilation produces multiple warnings about classes with
finaldestructors but non-final class declarations.Environment
Additional Context
The warning indicates an inconsistency: if a destructor is marked
final, the class definition should also be markedfinalto prevent inheritance. This is either:finalto prevent inheritance entirely, orfinalfrom the destructor if inheritance should be allowedThe fix requires identifying all affected class definitions and making them consistent.
Related Issues