diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 14b53a6b2..9ad1f62a1 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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)); } diff --git a/test/testother.cpp b/test/testother.cpp index 9466e0c8e..f3d7c3c30 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -837,6 +837,10 @@ private: testPassedByValue("void f(const std::map 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()