diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index f382b6734..dabeaa150 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2638,8 +2638,12 @@ void Tokenizer::setVarIdPass1() scopeStack.push(VarIdScopeInfo(isExecutable, scopeStack.top().isStructInit || tok->strAt(-1) == "=", isEnumStart(tok), _varId)); } else { /* if (tok->str() == "}") */ bool isNamespace = false; - for (const Token *tok1 = tok->link()->previous(); tok1 && tok1->isName(); tok1 = tok1->previous()) - isNamespace |= (tok1->str() == "namespace"); + for (const Token *tok1 = tok->link()->previous(); tok1 && tok1->isName(); tok1 = tok1->previous()) { + if (tok1->str() == "namespace") { + isNamespace = true; + break; + } + } // Set variable ids in class declaration.. if (!initlist && !isC() && !scopeStack.top().isExecutable && tok->link() && !isNamespace) { setVarIdClassDeclaration(tok->link(),