diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 7726b2a7f..27d69e803 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2345,7 +2345,8 @@ void CheckOther::checkMathFunctions() for (const Token* tok = scope->classStart->next(); tok != scope->classEnd; tok = tok->next()) { if (tok->varId()) continue; - if (Token::Match(tok, "log|logf|logl|log10|log10f|log10l ( %num% )")) { + if (!Token::Match(tok->previous(),".|->") + && Token::Match(tok, "log|logf|logl|log10|log10f|log10l ( %num% )")) { bool isNegative = MathLib::isNegative(tok->strAt(2)); bool isInt = MathLib::isInt(tok->strAt(2)); bool isFloat = MathLib::isFloat(tok->strAt(2)); diff --git a/test/testother.cpp b/test/testother.cpp index 48ee348e1..6b2c02eb2 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1651,6 +1651,10 @@ private: // #3473 - no warning if "log" is a variable check("Fred::Fred() : log(0) { }"); ASSERT_EQUALS("", errout.str()); + + // #5748 + check("void f() { foo.log(0); }"); + ASSERT_EQUALS("", errout.str()); } void mathfunctionCall_acos() {