Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff)

This commit is contained in:
Daniel Marjamäki 2011-04-19 20:07:54 +02:00
parent 47a1332e6a
commit 68e7003bb1
2 changed files with 5 additions and 1 deletions

View File

@ -2517,7 +2517,7 @@ void CheckOther::checkConstantFunctionParameter()
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next())
{
if (Token::Match(tok, "[,(] const std :: %type% %var% [,)]"))
if (Token::Match(tok, "[,(] const std :: string %var% [,)]"))
{
passedByValueError(tok, tok->strAt(5));
}

View File

@ -837,6 +837,10 @@ private:
testPassedByValue("void f(const std::map<std::string,int> v) {}");
ASSERT_EQUALS("[test.cpp:1]: (performance) Function parameter 'v' should be passed by reference.\n", errout.str());
testPassedByValue("void f(const std::streamoff pos) {}");
ASSERT_EQUALS("", errout.str());
}
void mathfunctionCall1()