Fixed #6674 (false positive 'unusedPrivateFunction' - calling virtual function in subclass)
This commit is contained in:
parent
c23c1f245c
commit
b7b92b2140
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue