diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index aa5a49fabfb..b7cf9858363 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -1738,6 +1738,8 @@ static Token * createAstAtToken(Token *tok) AST_state state(cpp); if (Token::Match(tok, "%name% (")) state.functionCallEndPar = tok->linkAt(1); + if (Token::simpleMatch(tok->tokAt(-1), "::") && (!tok->tokAt(-2) || !tok->tokAt(-2)->isName())) + tok = tok->tokAt(-1); compileExpression(tok, state); Token * const endToken = tok; if (endToken == tok1 || !endToken) @@ -1760,11 +1762,6 @@ static Token * createAstAtToken(Token *tok) return endToken->previous(); } - if (cpp && ((!tok->previous() && tok->str() == "::") || Token::Match(tok->previous(), "[;{}] ::"))) { - AST_state state(cpp); - compileUnaryOp(tok, state, nullptr); - } - return tok; }