Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };')
This commit is contained in:
parent
e784901303
commit
31484133c0
|
@ -3049,7 +3049,7 @@ void Tokenizer::createLinks2()
|
|||
} else if (token->str() == ">") {
|
||||
if (type.empty() || type.top()->str() != "<") // < and > don't match.
|
||||
continue;
|
||||
if (token->next() && !Token::Match(token->next(), "%name%|>|&|*|::|,|(|)|{|;|[|:"))
|
||||
if (token->next() && !Token::Match(token->next(), "%name%|>|&|*|::|,|(|)|{|}|;|[|:"))
|
||||
continue;
|
||||
|
||||
// if > is followed by [ .. "new a<b>[" is expected
|
||||
|
|
|
@ -292,6 +292,7 @@ private:
|
|||
TEST_CASE(simplifyStdType); // #4947, #4950, #4951
|
||||
|
||||
TEST_CASE(createLinks);
|
||||
TEST_CASE(createLinks2);
|
||||
TEST_CASE(signed1);
|
||||
|
||||
TEST_CASE(simplifyString);
|
||||
|
@ -4523,6 +4524,19 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void createLinks2() {
|
||||
{ // #7158
|
||||
const char code[] = "enum { value = boost::mpl::at_c<B, C> };";
|
||||
errout.str("");
|
||||
Tokenizer tokenizer(&settings0, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
const Token *tok = Token::findsimplematch(tokenizer.tokens(), "<");
|
||||
ASSERT_EQUALS(true, tok->link() == tok->tokAt(4));
|
||||
ASSERT_EQUALS(true, tok->linkAt(4) == tok);
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyString() {
|
||||
errout.str("");
|
||||
Tokenizer tokenizer(&settings0, this);
|
||||
|
|
Loading…
Reference in New Issue