Fixed #6586 (Tokenizer: '>>' is wrongly tokenized as '> >' - if (n1 < len>>1))

This commit is contained in:
Daniel Marjamäki 2015-04-03 20:25:22 +02:00
parent 4644e2a9a6
commit aacd9b9f6b
2 changed files with 2 additions and 1 deletions

View File

@ -305,7 +305,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
// ,/>
while (Token::Match(tok, ">|>>")) {
if (level == 0)
return numberOfParameters;
return ((tok->str() == ">") ? numberOfParameters : 0);
--level;
if (tok->str() == ">>") {
if (level == 0)

View File

@ -1150,6 +1150,7 @@ private:
ASSERT_EQUALS(1U, templateParameters("<const int> x;"));
ASSERT_EQUALS(1U, templateParameters("<int const *> x;"));
ASSERT_EQUALS(1U, templateParameters("<const struct C> x;"));
ASSERT_EQUALS(0U, templateParameters("<len>>x;"));
}
void templateParameters1() {