diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index c3b5f23cac7..1048eaca632 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8587,7 +8587,7 @@ void Tokenizer::findGarbageCode() const match2 = match2 || Token::Match(tok->next(), "try|catch|namespace"); } if (match1 && !tok->isIncDecOp()) { - match2 = match2 || Token::simpleMatch(tok->next(), "="); + match2 = match2 || Token::Match(tok->next(), "%assign%"); } if (match1 && match2) syntaxError(tok); diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index 68441504250..acb46bfe609 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -1749,6 +1749,7 @@ class TestGarbage : public TestFixture { } void garbageCode225() { ASSERT_THROW(checkCode("int n() { c * s0, 0 s0 = c(sizeof = ) }"), InternalError); + ASSERT_THROW(checkCode("int n() { c * s0, 0 s0 = c(sizeof |= ) }"), InternalError); } void syntaxErrorFirstToken() {