Fixed #3875 (Static member method called with class name is considered unused)
This commit is contained in:
parent
5174f7ff5e
commit
f967142436
|
@ -107,8 +107,15 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
|
|||
else if (Token::Match(tok, "[;{}.,()[=+-/&|!?:] %var% [(),;:}]"))
|
||||
funcname = tok->next();
|
||||
|
||||
else if (Token::Match(tok, "[=(,] & %var% :: %var% [,);]"))
|
||||
funcname = tok->tokAt(4);
|
||||
else if (Token::Match(tok, "[=(,] &| %var% :: %var%")) {
|
||||
funcname = tok->next();
|
||||
if (funcname->str() == "&")
|
||||
funcname = funcname->next();
|
||||
while (Token::Match(funcname,"%var% :: %var%"))
|
||||
funcname = funcname->tokAt(2);
|
||||
if (!Token::Match(funcname, "%var% [,);]"))
|
||||
continue;
|
||||
}
|
||||
|
||||
else
|
||||
continue;
|
||||
|
|
|
@ -135,6 +135,17 @@ private:
|
|||
" return 0\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("namespace abc {\n" // #3875
|
||||
"void foo() { }\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"int main()\n"
|
||||
"{\n"
|
||||
" f(abc::foo);\n"
|
||||
" return 0\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void template1() {
|
||||
|
|
Loading…
Reference in New Issue