diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 817f46967..e19f7fe3c 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -180,8 +180,12 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok) if (level == 0) ++numberOfParameters; + // skip const + if (Token::Match(tok, "const %any%")) + tok = tok->next(); + // skip struct/union - if (Token::Match(tok, "struct|union|const %any%")) + if (Token::Match(tok, "struct|union %any%")) tok = tok->next(); // skip std:: diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 95081e678..7d3f9e3e6 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -2291,6 +2291,7 @@ private: ASSERT_EQUALS(1U, templateParameters(" x;")); ASSERT_EQUALS(1U, templateParameters(" x;")); ASSERT_EQUALS(1U, templateParameters(" x;")); + ASSERT_EQUALS(1U, templateParameters(" x;")); }