$ cppcheck --enable=warning --std=c++17 --verbose issue.hpp
issue.hpp:11:30: warning: The struct 'Derived' defines member function with name 'clone' also defined in its parent struct 'Base < int >'. [duplInheritedMember]
std::unique_ptr<Base<int>> clone() const final {
^
issue.hpp:7:33: note: Parent function 'Base < int >::clone'
virtual std::unique_ptr<Base> clone() const = 0;
^
issue.hpp:11:30: note: Derived function 'Derived::clone'
std::unique_ptr<Base<int>> clone() const final {
Weirdly enough, the warning goes away if I remove the namespace from the example. Making the base class non-templated or changing final to override makes it disappear as well.
Version info:
cppcheck built from sources (d0a02bb)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I would like to report what appears to be a
duplInheritedMember
false positive related to thefinal
virtual function specifier.Weirdly enough, the warning goes away if I remove the namespace from the example. Making the base class non-templated or changing
final
tooverride
makes it disappear as well.Version info:
cppcheck built from sources (d0a02bb)
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12374
I have encountered the same issue.