fixed #3649 (False Positive: Uninitialized variable using operator assignment)

This commit is contained in:
Daniel Marjamäki 2012-03-06 18:51:50 +01:00
parent e0c880133c
commit 680883a6a7
2 changed files with 4 additions and 1 deletions

View File

@ -4360,7 +4360,7 @@ void Tokenizer::simplifyCompoundAssignment()
break; break;
} }
someOperator |= (tok2->isOp() || (tok2->str() == "?")); someOperator |= (tok2->isOp() || (tok2->str() == "?") || tok2->isAssignmentOp());
} }
} }

View File

@ -6103,6 +6103,9 @@ private:
ASSERT_EQUALS("; a = a + ( b && c ) ;", tokenizeAndStringify("; a+=b&&c;")); ASSERT_EQUALS("; a = a + ( b && c ) ;", tokenizeAndStringify("; a+=b&&c;"));
ASSERT_EQUALS("; a = a * ( b || c ) ;", tokenizeAndStringify("; a*=b||c;")); ASSERT_EQUALS("; a = a * ( b || c ) ;", tokenizeAndStringify("; a*=b||c;"));
ASSERT_EQUALS("; a = a | ( b == c ) ;", tokenizeAndStringify("; a|=b==c;")); ASSERT_EQUALS("; a = a | ( b == c ) ;", tokenizeAndStringify("; a|=b==c;"));
// #3469
ASSERT_EQUALS("; a = a + ( b = 1 ) ;", tokenizeAndStringify("; a += b = 1;"));
} }
void simplifyAssignmentInFunctionCall() { void simplifyAssignmentInFunctionCall() {