From 680883a6a7d477c0b03f567a4febe85b93f3ffd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 6 Mar 2012 18:51:50 +0100 Subject: [PATCH] fixed #3649 (False Positive: Uninitialized variable using operator assignment) --- lib/tokenize.cpp | 2 +- test/testtokenize.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 35f2dd721..1f7fa463e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -4360,7 +4360,7 @@ void Tokenizer::simplifyCompoundAssignment() break; } - someOperator |= (tok2->isOp() || (tok2->str() == "?")); + someOperator |= (tok2->isOp() || (tok2->str() == "?") || tok2->isAssignmentOp()); } } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 69884619a..b915b5f49 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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;")); + + // #3469 + ASSERT_EQUALS("; a = a + ( b = 1 ) ;", tokenizeAndStringify("; a += b = 1;")); } void simplifyAssignmentInFunctionCall() {