Fixed #5695 (FP: Mismatching assignment and comparison)
This commit is contained in:
parent
b354de6b23
commit
5ad3ac2653
|
@ -99,6 +99,8 @@ bool CheckAssignIf::assignIfParseScope(const Token * const assignTok,
|
|||
}
|
||||
return true;
|
||||
}
|
||||
if (Token::Match(tok2, "++|-- %varid%", varid) || Token::Match(tok2, "%varid% ++|--", varid))
|
||||
return true;
|
||||
if (Token::Match(tok2, "[(,] &| %varid% [,)]", varid)) {
|
||||
unsigned int argumentNumber = 0;
|
||||
const Token *ftok;
|
||||
|
|
|
@ -225,6 +225,17 @@ private:
|
|||
" else if (rHitObject.IsClosedObj() && !&rHitObject) { }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5695: increment
|
||||
check("void f(int a0, int n) {\n"
|
||||
" int c = a0 & 3;\n"
|
||||
" for (int a = 0; a < n; a++) {\n"
|
||||
" c++;\n"
|
||||
" if (c == 4)\n"
|
||||
" c = 0;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void mismatchingBitAnd() {
|
||||
|
|
Loading…
Reference in New Issue