diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 6f7932733..3384bf69b 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -317,7 +317,7 @@ void CheckType::checkLongCast() // Assignments.. for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) { - if (tok->str() != "=" || !Token::Match(tok->astOperand2(), "*|<<")) + if (tok->str() != "=" || !Token::Match(tok->astOperand2(), "*|<<") || tok->astOperand2()->isUnaryOp("*")) continue; if (tok->astOperand2()->hasKnownIntValue()) { diff --git a/test/testtype.cpp b/test/testtype.cpp index c49ef7aae..3d84c6180 100644 --- a/test/testtype.cpp +++ b/test/testtype.cpp @@ -367,6 +367,11 @@ private: "}\n", settings); ASSERT_EQUALS("[test.cpp:2]: (style) float result is returned as double value. If the return value is double to avoid loss of information, then you have loss of information.\n", errout.str()); + + check("void f(int* p) {\n" // #11862 + " long long j = *(p++);\n" + "}\n", settings); + ASSERT_EQUALS("", errout.str()); } void longCastReturn() {