Fixed #1508 (false positive : uninitialized variable)

This commit is contained in:
Daniel Marjamäki 2010-03-18 19:23:38 +01:00
parent 45987e5e9f
commit 95d22de690
1 changed files with 15 additions and 6 deletions

View File

@ -1926,13 +1926,22 @@ void Tokenizer::simplifyTemplates2()
if (tok->str() == "(")
tok = tok->link();
else if (Token::Match(tok, "; %type% < %type% > ("))
else if (Token::Match(tok, "; %type% <"))
{
const Token *tok2 = tok->tokAt(3);
std::string type;
while (Token::Match(tok2, "%type% ,") || Token::Match(tok2, "%num% ,"))
{
type += tok2->str() + ",";
tok2 = tok2->tokAt(2);
}
if (Token::Match(tok2, "%type% > (") || Token::Match(tok2, "%num% > ("))
{
type += tok2->str();
tok = tok->next();
tok->str(tok->str() + "<" + tok->strAt(2) + ">");
tok->deleteNext();
tok->deleteNext();
tok->deleteNext();
tok->str(tok->str() + "<" + type + ">");
Token::eraseTokens(tok, tok2->tokAt(2));
}
}
}
}