This commit is contained in:
parent
a6b0129725
commit
101ddea1e6
|
@ -5250,7 +5250,8 @@ void Tokenizer::createLinks2()
|
|||
} else if (token->str() == "<" &&
|
||||
((token->previous() && (token->previous()->isTemplate() ||
|
||||
(token->previous()->isName() && !token->previous()->varId()) ||
|
||||
(token->strAt(-1) == "]" && (!Token::Match(token->linkAt(-1)->previous(), "%name%|)") || token->linkAt(-1)->previous()->isKeyword())))) ||
|
||||
(token->strAt(-1) == "]" && (!Token::Match(token->linkAt(-1)->previous(), "%name%|)") || token->linkAt(-1)->previous()->isKeyword())) ||
|
||||
(token->strAt(-1) == ")" && token->linkAt(-1)->strAt(-1) == "operator"))) ||
|
||||
Token::Match(token->next(), ">|>>"))) {
|
||||
type.push(token);
|
||||
if (token->previous()->str() == "template")
|
||||
|
|
|
@ -3531,6 +3531,25 @@ private:
|
|||
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "struct S {\n" // #11840
|
||||
" template<typename T, typename U>\n"
|
||||
" void operator() (int);\n"
|
||||
"};\n"
|
||||
"void f() {\n"
|
||||
" S s;\n"
|
||||
" s.operator()<int, int>(1);\n"
|
||||
"}\n";
|
||||
errout.str("");
|
||||
Tokenizer tokenizer(&settings0, this);
|
||||
std::istringstream istr(code);
|
||||
ASSERT(tokenizer.tokenize(istr, "test.cpp"));
|
||||
const Token* tok1 = Token::findsimplematch(tokenizer.tokens(), "< int");
|
||||
const Token* tok2 = Token::findsimplematch(tok1, "> (");
|
||||
ASSERT_EQUALS(true, tok1->link() == tok2);
|
||||
ASSERT_EQUALS(true, tok2->link() == tok1);
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyString() {
|
||||
|
|
Loading…
Reference in New Issue