Skip to content

[BUG] Fix final destructor compilation warnings #582

@Miou-zora

Description

@Miou-zora

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

  1. Compile the project with a modern C++ compiler (Clang, GCC with -Wfinal-dtor-non-final-class enabled)
  2. 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:

  1. A design intent: mark the class as final to prevent inheritance entirely, or
  2. Remove final from the destructor if inheritance should be allowed

The fix requires identifying all affected class definitions and making them consistent.

Related Issues

  • N/A

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingbuildEverything related to the build system

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions