diff --git a/lib/checknullpointer.cpp b/lib/checknullpointer.cpp index d5f8429d7..ae97e7d58 100644 --- a/lib/checknullpointer.cpp +++ b/lib/checknullpointer.cpp @@ -866,7 +866,7 @@ void CheckNullPointer::nullConstantDereference() } } - else if (indentlevel > 0 && Token::Match(tok, "%var% (")) + else if (indentlevel > 0 && Token::Match(tok->previous(), "[={};] %var% (")) { std::list var; parseFunctionCall(*tok, var, 0); diff --git a/test/testnullpointer.cpp b/test/testnullpointer.cpp index 9829abf73..7e80456e0 100644 --- a/test/testnullpointer.cpp +++ b/test/testnullpointer.cpp @@ -1250,6 +1250,11 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + // Ticket #3126 - don't confuse member function with standard function + check("void f() {\n" + " image1.fseek(0, SEEK_SET);\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void gcc_statement_expression()