parent
da6c39e971
commit
5ff8955dbe
|
@ -317,7 +317,7 @@ void CheckType::checkLongCast()
|
||||||
|
|
||||||
// Assignments..
|
// Assignments..
|
||||||
for (const Token *tok = mTokenizer->tokens(); tok; tok = tok->next()) {
|
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;
|
continue;
|
||||||
|
|
||||||
if (tok->astOperand2()->hasKnownIntValue()) {
|
if (tok->astOperand2()->hasKnownIntValue()) {
|
||||||
|
|
|
@ -367,6 +367,11 @@ private:
|
||||||
"}\n", settings);
|
"}\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",
|
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());
|
errout.str());
|
||||||
|
|
||||||
|
check("void f(int* p) {\n" // #11862
|
||||||
|
" long long j = *(p++);\n"
|
||||||
|
"}\n", settings);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void longCastReturn() {
|
void longCastReturn() {
|
||||||
|
|
Loading…
Reference in New Issue