Fixed #4860 (Segfault with another Clucene file)
This commit is contained in:
parent
a781a83822
commit
6819f5ed18
|
@ -3171,7 +3171,7 @@ void Tokenizer::createLinks2()
|
|||
else if (token->str() == ">" || token->str() == ">>") {
|
||||
if (type.empty() || type.top()->str() != "<") // < and > don't match.
|
||||
continue;
|
||||
if (token->next() && !token->next()->isName() && !Token::Match(token->next(), ">|&|*|::|,|(|)"))
|
||||
if (token->next() && !Token::Match(token->next(), "%var%|>|&|*|::|,|(|)|{"))
|
||||
continue;
|
||||
|
||||
// Check type of open link
|
||||
|
|
|
@ -6441,6 +6441,23 @@ private:
|
|||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
{
|
||||
// #4860
|
||||
const char code[] = "class A : public B<int> {};";
|
||||
errout.str("");
|
||||
Settings settings;
|
||||
Tokenizer tokenizer(&settings, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
const Token *tok = tokenizer.tokens();
|
||||
|
||||
// B<..>
|
||||
ASSERT_EQUALS(true, tok->tokAt(5) == tok->linkAt(7));
|
||||
ASSERT_EQUALS(true, tok->linkAt(5) == tok->tokAt(7));
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
}
|
||||
|
||||
void removeExceptionSpecification1() {
|
||||
|
|
Loading…
Reference in New Issue