Tokenizer::setVarIdNew: Fixed TestTokenizer::varid_operator test case

This commit is contained in:
Daniel Marjamäki 2012-04-21 19:29:24 +02:00
parent f3cbb3f05d
commit 6d9b4a8032
1 changed files with 8 additions and 0 deletions

View File

@ -2978,6 +2978,14 @@ void Tokenizer::setVarIdNew()
}
else if (decl && Token::Match(tok2->previous(), "%type% ( !!)")) {
// In C++ , a variable can't be called operator+ or something like that.
if (isCPP() &&
tok2->previous()->str().size() >= 9 &&
tok2->previous()->str().compare(0, 8, "operator") == 0 &&
tok2->previous()->str()[8] != '_' &&
!std::isalnum(tok2->previous()->str()[8]))
continue;
const Token *tok3 = tok2->next();
if (!tok3->isStandardType() && !setVarIdParseDeclaration(&tok3,variableId,executableScope.top())) {
variableId[tok2->previous()->str()] = ++_varId;