In a bit of code involving multiple inheritance and nested classes I have an issue where cppcheck don't attribute the proper inheritance and think two independant classes are based/derived from each other.
The issue can be seens with the following code with 2.10 and current head of main.
test.cpp:7:16: style: The destructor '~Nested' overrides a destructor in a base class but is not marked with a 'override' specifier. [missingOverride]
virtual ~Nested() = default;
^
test.cpp:17:16: note: Virtual destructor in base class
virtual ~Nested() = default;
^
test.cpp:7:16: note: Destructor in derived class
virtual ~Nested() = default;
Looking at cppcheck debug output, it consider that A::Nested is derived from B::Nested
(and, yes, the inheritance scheme here is debatable)
Last edit: Lionel Gimbert 2023-03-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
In a bit of code involving multiple inheritance and nested classes I have an issue where cppcheck don't attribute the proper inheritance and think two independant classes are based/derived from each other.
The issue can be seens with the following code with 2.10 and current head of main.
Which produce the following output:
Looking at cppcheck debug output, it consider that A::Nested is derived from B::Nested
(and, yes, the inheritance scheme here is debatable)
Last edit: Lionel Gimbert 2023-03-14
Thanks for reporting, fixed by https://github.com/danmar/cppcheck/pull/4894
Damn, that was quick!
Thanks.