diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 210abbb91..a10c737f7 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -2789,7 +2789,9 @@ bool Function::isImplicitlyVirtual_rec(const ::Type* baseType, bool& safe) const // check for matching return parameters while (temp1->str() != "virtual") { - if (temp1->str() != temp2->str()) { + if (temp1->str() != temp2->str() && + !(temp1->str() == derivedFromType->name() && + temp2->str() == baseType->name())) { returnMatch = false; break; } diff --git a/test/testunusedprivfunc.cpp b/test/testunusedprivfunc.cpp index ff63d565f..c44aaf5fd 100644 --- a/test/testunusedprivfunc.cpp +++ b/test/testunusedprivfunc.cpp @@ -481,6 +481,24 @@ private: " void func() {}\n" "};"); ASSERT_EQUALS("", errout.str()); + + check("class Base {\n" + "public:\n" + " void dostuff() {\n" + " f();\n" + " }\n" + "\n" + "private:\n" + " virtual Base* f() = 0;\n" + "};\n" + "\n" + "class Derived : public Base {\n" + "private:\n" + " Derived* f() {\n" + " return 0;\n" + " }\n" + "};"); + ASSERT_EQUALS("", errout.str()); } void friendClass() {