From 68e7003bb1120fb4d20319597693c5ef56dfac23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 19 Apr 2011 20:07:54 +0200 Subject: [PATCH] Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff) --- lib/checkother.cpp | 2 +- test/testother.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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()