fix #2580 (false postive with Unused private function)
This commit is contained in:
parent
d4f204a25a
commit
218464df89
|
@ -906,12 +906,14 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
|
|||
base.name += tok2->str();
|
||||
base.scope = 0;
|
||||
|
||||
// don't add unhandled templates
|
||||
// add unhandled templates
|
||||
if (tok2->next()->str() == "<")
|
||||
{
|
||||
int level1 = 1;
|
||||
while (tok2->next())
|
||||
{
|
||||
base.name += tok2->next()->str();
|
||||
|
||||
if (tok2->next()->str() == ">")
|
||||
{
|
||||
level1--;
|
||||
|
@ -926,10 +928,7 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
|
|||
}
|
||||
|
||||
// save pattern for base class name
|
||||
else
|
||||
{
|
||||
scope->derivedFrom.push_back(base);
|
||||
}
|
||||
scope->derivedFrom.push_back(base);
|
||||
}
|
||||
tok2 = tok2->next();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ private:
|
|||
TEST_CASE(testDoesNotIdentifyMethodAsLastFunctionArgument);
|
||||
|
||||
TEST_CASE(multiFile);
|
||||
TEST_CASE(unknownBaseTemplate); // ticket #2580
|
||||
}
|
||||
|
||||
|
||||
|
@ -571,6 +572,20 @@ private:
|
|||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void unknownBaseTemplate() // ticket #2580
|
||||
{
|
||||
check("class Bla : public Base2<Base> {\n"
|
||||
"public:\n"
|
||||
" Bla() {}\n"
|
||||
"private:\n"
|
||||
" virtual void F() const;\n"
|
||||
"};\n"
|
||||
"void Bla::F() const { }");
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestUnusedPrivateFunction)
|
||||
|
|
Loading…
Reference in New Issue