Fixed createLinks2() when > is followed by ; (#6242)
This commit is contained in:
parent
6c1bb76599
commit
6fdaf65cea
|
@ -2885,9 +2885,8 @@ void Tokenizer::createLinks2()
|
|||
if (token->str() == ">>" && type.size() < 2)
|
||||
continue;
|
||||
|
||||
// if > is followed by ; .. "new a<b>;" is expected
|
||||
// if > is followed by [ .. "new a<b>[" is expected
|
||||
if (Token::Match(token->next(), ";|[")) {
|
||||
if (token->strAt(1) == "[") {
|
||||
Token *prev = type.top()->previous();
|
||||
while (prev && Token::Match(prev->previous(), ":: %var%"))
|
||||
prev = prev->tokAt(-2);
|
||||
|
|
|
@ -4887,6 +4887,21 @@ private:
|
|||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
{
|
||||
// #6242
|
||||
const char code[] = "func = integral_<uchar, int, double>;";
|
||||
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->tokAt(3) == tok->linkAt(9));
|
||||
ASSERT_EQUALS(true, tok->linkAt(3) == tok->tokAt(9));
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
{
|
||||
// if (a < b || c > d) { }
|
||||
|
|
Loading…
Reference in New Issue