diff --git a/src/checkother.cpp b/src/checkother.cpp index e52489e7d..1d229509c 100644 --- a/src/checkother.cpp +++ b/src/checkother.cpp @@ -762,6 +762,12 @@ void CheckOther::CheckIncompleteStatement() if (parlevel != 0) continue; + if (tok->previous() && Token::Match(tok->previous(), "=")) + { + /* We are inside an assignment, so it's not a statement. */ + continue; + } + if (Token::Match(tok, "[;{}] %str%") && !Token::Match(tok->tokAt(2), "[,}]")) { _errorLogger->constStatement(_tokenizer, tok->next(), "string"); diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index f2530a0f4..6f9b3e1ac 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -64,7 +64,7 @@ private: TEST_CASE(test4); TEST_CASE(test5); TEST_CASE(test_numeric); - // TODO TEST_CASE(intarray); + TEST_CASE(intarray); } void test1()