Fixed #6249 (False positive: Incorrect detection of (assignment + comparison) inside for-clause)
This commit is contained in:
parent
f19d4afcde
commit
eec938dbad
|
@ -781,7 +781,8 @@ void CheckCondition::clarifyCondition()
|
|||
// This might be a template
|
||||
if (!isC && tok2->link())
|
||||
break;
|
||||
|
||||
if (Token::simpleMatch(tok2->astParent(), "?"))
|
||||
break;
|
||||
clarifyConditionError(tok, tok->strAt(2) == "=", false);
|
||||
break;
|
||||
} else if (!tok2->isName() && !tok2->isNumber() && tok2->str() != ".")
|
||||
|
|
|
@ -1213,6 +1213,10 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
" if (x = b < 0 ? 1 : 2) {}\n" // don't simplify and verify this code
|
||||
"}", false);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
// clarify conditions with bitwise operator and comparison
|
||||
|
|
Loading…
Reference in New Issue