Improvement to 5b8840c6b02bd648dc2b75e60145474ae12f8e67: handle also 'const struct|union' types as template parameters.

This commit is contained in:
Edoardo Prezioso 2012-04-27 20:51:55 +02:00
parent 5b8840c6b0
commit 6fd6f0998b
2 changed files with 6 additions and 1 deletions

View File

@ -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::

View File

@ -2291,6 +2291,7 @@ private:
ASSERT_EQUALS(1U, templateParameters("<union C> x;"));
ASSERT_EQUALS(1U, templateParameters("<const int> x;"));
ASSERT_EQUALS(1U, templateParameters("<int const *> x;"));
ASSERT_EQUALS(1U, templateParameters("<const struct C> x;"));
}