I fixed the warning and started to have test failures because the wrong function was being called in the base class vs. derived.
I had a hard time getting a code example and left test support in.
class UselessExample //: public Test { public: UselessExample() = default; ~UselessExample() = default; // void SetUp() override // { // CreateObject(); // } virtual void CreateObject() { SetupTheAccessor(); } virtual void SetupTheAccessor() { SetValues(); } void SetValues() // not virtual { } }; class UselessOverrideExample: public UselessExample { public: UselessOverrideExample() = default; ~UselessOverrideExample() = default; // style: uselessOverride - The function 'SetupTheAccessor' overrides a function in a base class but is identical to the overridden function // fixing the useless override warning causes wrong SetValues() void SetupTheAccessor() override { SetValues(); } virtual void SetValues()// taking virtual off gives duplInheritedMember warning { // does something different than base } };
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12706
Log in to post a comment.
I fixed the warning and started to have test failures because the wrong function was being called in the base class vs. derived.
I had a hard time getting a code example and left test support in.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12706