diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 77d797eb0a4..c0e4cfcf5fe 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8636,7 +8636,7 @@ void Tokenizer::findGarbageCode() const syntaxError(tok); if (Token::Match(tok, "%assign% typename|class %assign%")) syntaxError(tok); - if (Token::Match(tok, "%assign% [;)}]") && (!isCPP() || !Token::Match(tok->previous(), "operator %assign% ;"))) + if (Token::Match(tok, "%assign% [;)}]") && (!isCPP() || !Token::simpleMatch(tok->previous(), "operator"))) syntaxError(tok); if (Token::Match(tok, "%cop%|=|,|[ %or%|%oror%|/|%")) syntaxError(tok);