Fixed #8115 (Tokenizer: links not properly set in r-value template 'Foo<int> && foo')
This commit is contained in:
parent
ea598d5284
commit
dff9d13758
|
@ -3071,7 +3071,7 @@ void Tokenizer::createLinks2()
|
||||||
if (type.empty() || type.top()->str() != "<") // < and > don't match.
|
if (type.empty() || type.top()->str() != "<") // < and > don't match.
|
||||||
continue;
|
continue;
|
||||||
if (token->next() &&
|
if (token->next() &&
|
||||||
!Token::Match(token->next(), "%name%|>|&|*|::|,|(|)|{|}|;|[|:") &&
|
!Token::Match(token->next(), "%name%|>|&|&&|*|::|,|(|)|{|}|;|[|:") &&
|
||||||
!Token::Match(token->next(), "&& %name% ="))
|
!Token::Match(token->next(), "&& %name% ="))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -4616,6 +4616,19 @@ private:
|
||||||
ASSERT_EQUALS(true, tok1->link() == tok2);
|
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||||
ASSERT_EQUALS(true, tok2->link() == tok1);
|
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// #8115
|
||||||
|
const char code[] = "void Test(C<int> && c);";
|
||||||
|
errout.str("");
|
||||||
|
Tokenizer tokenizer(&settings0, this);
|
||||||
|
std::istringstream istr(code);
|
||||||
|
tokenizer.tokenize(istr, "test.cpp");
|
||||||
|
const Token *tok1 = Token::findsimplematch(tokenizer.tokens(), "<");
|
||||||
|
const Token *tok2 = tok1->tokAt(2);
|
||||||
|
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||||
|
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyString() {
|
void simplifyString() {
|
||||||
|
|
Loading…
Reference in New Issue