Skip to content

Commit 2ebfe41

Browse files
Update checkother.cpp
1 parent 3deb36d commit 2ebfe41

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/checkother.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,6 +3054,14 @@ void CheckOtherImpl::checkDuplicateExpression()
30543054
checkDuplicate(ast1->astOperand1(), tok->astOperand2(), ast1);
30553055
ast1 = ast1->astOperand1();
30563056
}
3057+
if (tok->str() != "=") {
3058+
const Token* par = tok->astParent();
3059+
while (par && tok->str() == par->str() && precedes(par, tok)) { // chain of identical operators with parentheses
3060+
checkDuplicate(par->astOperand1(), tok->astOperand1(), par);
3061+
checkDuplicate(par->astOperand1(), tok->astOperand2(), par);
3062+
par = par->astParent();
3063+
}
3064+
}
30573065
}
30583066
}
30593067
} else if (tok->astOperand1() && tok->astOperand2() && tok->str() == ":" && tok->astParent() && tok->astParent()->str() == "?") {

0 commit comments

Comments
 (0)