Fixed 'Syntax Error' when < link is not set properly
This commit is contained in:
parent
21ec78d8a1
commit
0144db2490
|
@ -3863,7 +3863,7 @@ void Tokenizer::createLinks2()
|
|||
const bool isScoped = Token::simpleMatch(token->tokAt(-2), "::") ||
|
||||
(Token::Match(token->tokAt(-2), "; %name% <") && usingNames.count(token->previous()->str()));
|
||||
const bool isTemplateDecl = isScoped || Token::Match(token->tokAt(-2), "%name% %name% <");
|
||||
const bool isTemplateArgPointerType = Token::Match(token, "< %name%| %type% * >");
|
||||
const bool isTemplateArgPointerType = Token::Match(token, "< %type% * >");
|
||||
if (!isTemplateDecl && !isTemplateArgPointerType) {
|
||||
std::map<std::string, bool>::const_iterator it = templateNames.find(token->previous()->str());
|
||||
if (it == templateNames.end()) {
|
||||
|
|
|
@ -4787,6 +4787,18 @@ private:
|
|||
tokenizer.tokenize(istr, "test.cpp");
|
||||
ASSERT(nullptr != Token::findsimplematch(tokenizer.tokens(), "<")->link());
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "using std::set;\n"
|
||||
"void foo()\n"
|
||||
"{\n"
|
||||
" for (set<ParticleSource*>::iterator i = sources.begin(); i != sources.end(); ++i) {}\n"
|
||||
"}";
|
||||
Tokenizer tokenizer(&settings0, this);
|
||||
std::istringstream istr(code);
|
||||
tokenizer.tokenize(istr, "test.cpp");
|
||||
ASSERT(nullptr != Token::findsimplematch(tokenizer.tokens(), "<")->link());
|
||||
}
|
||||
}
|
||||
|
||||
void simplifyString() {
|
||||
|
|
Loading…
Reference in New Issue