diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 42d50f63571..f5e7f8bd511 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -4617,8 +4617,9 @@ void Tokenizer::setVarIdPass1() if (!(scopeStack.top().isStructInit || tok->strAt(-1) == "=")) variableMap.enterScope(); } + const bool isStructInit = scopeStack.top().isStructInit || tok->strAt(-1) == "=" || (initlist && !Token::Match(tok->tokAt(-1), "[)}]")); + scopeStack.emplace(isExecutable, isStructInit, isEnumStart(tok), variableMap.getVarId()); initlist = false; - scopeStack.emplace(isExecutable, scopeStack.top().isStructInit || tok->strAt(-1) == "=", isEnumStart(tok), variableMap.getVarId()); } else { /* if (tok->str() == "}") */ bool isNamespace = false; for (const Token *tok1 = tok->link()->previous(); tok1 && tok1->isName(); tok1 = tok1->previous()) {