Tokenizer::createLinks2: set no template-links in 'if (a < b || c > d)'

This commit is contained in:
Daniel Marjamäki 2014-08-17 19:03:06 +02:00
parent ebc0b6cd44
commit a52c122229
2 changed files with 14 additions and 1 deletions

View File

@ -2799,7 +2799,7 @@ void Tokenizer::createLinks2()
token->link(0);
}
else if (token->str() == ";")
else if (Token::Match(token, "%oror%|&&|;"))
while (!type.empty() && type.top()->str() == "<")
type.pop();
else if (token->str() == "<" && token->previous() && token->previous()->isName() && !token->previous()->varId())

View File

@ -7093,6 +7093,19 @@ private:
ASSERT_EQUALS("", errout.str());
}
{
// if (a < b || c > d) { }
const char code[] = "if (a < b || c > d);";
errout.str("");
Settings settings;
Tokenizer tokenizer(&settings, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
const Token *tok = tokenizer.tokens();
ASSERT_EQUALS(true, tok->linkAt(3) == nullptr);
}
}
void simplifyString() {