diff --git a/lib/checkother.cpp b/lib/checkother.cpp index d12a802fb..45274bb2d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1976,6 +1976,9 @@ void CheckOther::checkConstantFunctionParameter() if (!var || !var->isArgument() || !var->isClass() || !var->isConst() || var->isPointer() || var->isArray() || var->isReference()) continue; + if (var->scope()->function->arg->link()->strAt(-1) == ".") + continue; // references could not be used as va_start parameters (#5824) + const Token* const tok = var->typeStartToken(); // TODO: False negatives. This pattern only checks for string. // Investigate if there are other classes in the std diff --git a/test/testother.cpp b/test/testother.cpp index c37b18f99..bcc64e299 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1632,7 +1632,8 @@ 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) {}"); + // #5824 + testPassedByValue("void log(const std::string& file, int line, const std::string& function, const std::string str, ...) {}"); ASSERT_EQUALS("", errout.str()); }