Fixed #7409 (Tokenizer: Links not set properly 'Data<T&&>')

This commit is contained in:
Daniel Marjamäki 2016-05-14 20:40:30 +02:00
parent 7591a57587
commit 2cb03b3fd0
2 changed files with 13 additions and 0 deletions

View File

@ -3090,6 +3090,8 @@ void Tokenizer::createLinks2()
} else
token->link(0);
} else if (!templateToken && !isStruct && Token::Match(token, "%oror%|&&|;")) {
if (Token::Match(token, "&& [,>]"))
continue;
while (!type.empty() && type.top()->str() == "<")
type.pop();
} else if (token->str() == "<" && token->previous() && token->previous()->isName() && !token->previous()->varId()) {

View File

@ -4549,6 +4549,17 @@ private:
ASSERT_EQUALS(true, tok->tokAt(4) == tok->linkAt(8));
}
{
const char code[] = "Data<T&&>";
errout.str("");
Tokenizer tokenizer(&settings0, this);
std::istringstream istr(code);
tokenizer.tokenize(istr, "test.cpp");
const Token *tok = tokenizer.tokens();
ASSERT_EQUALS(true, tok->linkAt(1) == tok->tokAt(4));
ASSERT_EQUALS(true, tok->tokAt(1) == tok->linkAt(4));
}
{
// #6601
const char code[] = "template<class R> struct FuncType<R(&)()> : FuncType<R()> { };";