Skip to content

Commit aacd9b9

Browse files
committed
Fixed danmar#6586 (Tokenizer: '>>' is wrongly tokenized as '> >' - if (n1 < len>>1))
1 parent 4644e2a commit aacd9b9

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/templatesimplifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
305305
// ,/>
306306
while (Token::Match(tok, ">|>>")) {
307307
if (level == 0)
308-
return numberOfParameters;
308+
return ((tok->str() == ">") ? numberOfParameters : 0);
309309
--level;
310310
if (tok->str() == ">>") {
311311
if (level == 0)

test/testsimplifytemplate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,7 @@ class TestSimplifyTemplate : public TestFixture {
11501150
ASSERT_EQUALS(1U, templateParameters("<const int> x;"));
11511151
ASSERT_EQUALS(1U, templateParameters("<int const *> x;"));
11521152
ASSERT_EQUALS(1U, templateParameters("<const struct C> x;"));
1153+
ASSERT_EQUALS(0U, templateParameters("<len>>x;"));
11531154
}
11541155

11551156
void templateParameters1() {

0 commit comments

Comments
 (0)