diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 33bcd3de6..d31980719 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -114,7 +114,7 @@ bool isSameExpression(const Token *tok1, const Token *tok2, const std::setisAssignmentOp()) return false; if (tok1->str() == "(" && tok1->previous() && !tok1->previous()->isName()) { // cast => assert that the casts are equal const Token *t1 = tok1->next(); diff --git a/test/testother.cpp b/test/testother.cpp index 398571629..f9a013220 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -4974,6 +4974,12 @@ private: " if (*a-- != b || *a-- != b) {}\n" "}"); ASSERT_EQUALS("", errout.str()); + + // assignment + check("void f() {\n" + " while (*(a+=2)==*(b+=2) && *(a+=2)==*(b+=2)) {}\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void duplicateExpression5() { // #3749 - macros with same values