diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 1b824e6d1..52719bd4c 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -724,11 +724,10 @@ int TemplateSimplifier::getTemplateNamePosition(const Token *tok) (Token::Match(tok, "> %type% %type% <") && Token::Match(tok->linkAt(3), "> :: %type% ("))) { namepos = 2 + (Token::Match(tok, "> %type% %type%")); const Token *end = tok->linkAt(namepos); - for(const Token *tok2 = tok->tokAt(namepos) ; tok2 != end ; tok2 = tok2->next()) + for (const Token *tok2 = tok->tokAt(namepos) ; tok2 != end ; tok2 = tok2->next()) ++namepos; namepos += 2; - } - else if (Token::Match(tok, "> %type% *|&| %type% :: %type% (")) { + } else if (Token::Match(tok, "> %type% *|&| %type% :: %type% (")) { namepos = 4; starAmpPossiblePosition = 2; } else if (Token::Match(tok, "> %type% %type% *|&| %type% :: %type% (")) { diff --git a/test/testsimplifytemplate.cpp b/test/testsimplifytemplate.cpp index a8317bf1d..4637e7d10 100644 --- a/test/testsimplifytemplate.cpp +++ b/test/testsimplifytemplate.cpp @@ -1373,13 +1373,13 @@ private: "template const unsigned A::B::foo() { return 0; }", 25)); // Template class member ASSERT_EQUALS(6, templateNamePositionHelper("template class A { A(); }; " - "template A::A() {}", 18)); + "template A::A() {}", 18)); ASSERT_EQUALS(8, templateNamePositionHelper("template class A { A(); }; " - "template A::A() {}", 24)); + "template A::A() {}", 24)); ASSERT_EQUALS(7, templateNamePositionHelper("template class A { unsigned foo(); }; " - "template unsigned A::foo() { return 0; }", 19)); + "template unsigned A::foo() { return 0; }", 19)); ASSERT_EQUALS(9, templateNamePositionHelper("template class A { unsigned foo(); }; " - "template unsigned A::foo() { return 0; }", 25)); + "template unsigned A::foo() { return 0; }", 25)); } void expandSpecialized() {