diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index d4fd65559..47a1f9ccc 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2389,6 +2389,14 @@ bool Tokenizer::tokenize(std::istream &code, break; } + // skip executing scopes (ticket #3183).. + if (Token::simpleMatch(tok, "( {")) + { + tok = tok->next()->link(); + if (!tok) + break; + } + // skip executing scopes (ticket #1985).. if (Token::simpleMatch(tok, "try {")) { diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 754de6c50..1d919dec8 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -4582,6 +4582,16 @@ private: ASSERT_EQUALS("", errout.str()); } + // ok code (ticket #3183) + { + errout.str(); + std::istringstream istr("MACRO(({ i < x }))"); + Settings settings; + Tokenizer tokenizer(&settings, this); + tokenizer.tokenize(istr, "test.cpp"); + ASSERT_EQUALS("", errout.str()); + } + // bad code.. missing ">" { errout.str("");