Fixed createLinks2() when inheriting from a template (#6601)
This commit is contained in:
parent
eb2b0fa0d0
commit
62bc827eb0
|
@ -3025,7 +3025,7 @@ void Tokenizer::createLinks2()
|
||||||
else if (token->str() == ">") {
|
else if (token->str() == ">") {
|
||||||
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() && !Token::Match(token->next(), "%name%|>|&|*|::|,|(|)|{|;|["))
|
if (token->next() && !Token::Match(token->next(), "%name%|>|&|*|::|,|(|)|{|;|[|:"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if > is followed by [ .. "new a<b>[" is expected
|
// if > is followed by [ .. "new a<b>[" is expected
|
||||||
|
|
|
@ -4489,6 +4489,24 @@ private:
|
||||||
|
|
||||||
ASSERT_EQUALS(true, tok->linkAt(3) == nullptr);
|
ASSERT_EQUALS(true, tok->linkAt(3) == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// #6601
|
||||||
|
const char code[] = "template<class R> struct FuncType<R(&)()> : FuncType<R()> { };";
|
||||||
|
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)); // <class R>
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(7) == tok->tokAt(14)); // <R(&)()>
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(9) == tok->tokAt(11)); // (&)
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(12) == tok->tokAt(13)); // ()
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(17) == tok->tokAt(21)); // <R()>
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(19) == tok->tokAt(20)); // ()
|
||||||
|
ASSERT_EQUALS(true, tok->linkAt(22) == tok->tokAt(23)); // {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void simplifyString() {
|
void simplifyString() {
|
||||||
|
|
Loading…
Reference in New Issue