Fixed handling of pointers to functions in namespace as template parameters (#4172)

This commit is contained in:
PKEuS 2012-11-04 11:15:03 +01:00
parent 9cb9388e49
commit e44ee280bc
2 changed files with 7 additions and 1 deletions

View File

@ -188,7 +188,7 @@ unsigned int TemplateSimplifier::templateParameters(const Token *tok)
tok = tok->next();
// Skip '&'
if (Token::Match(tok, "& %var% [,>]"))
if (Token::Match(tok, "& ::| %var%"))
tok = tok->next();
// skip std::

View File

@ -260,6 +260,7 @@ private:
TEST_CASE(varid_catch);
TEST_CASE(varid_functionPrototypeTemplate);
TEST_CASE(varid_templatePtr); // #4319
TEST_CASE(varid_templateNamespaceFuncPtr); // #4172
TEST_CASE(varidclass1);
TEST_CASE(varidclass2);
@ -4063,6 +4064,11 @@ private:
"1: std :: map < int , FooTemplate < int > * > dummy_member@1 [ 1 ] ;\n", tokenizeDebugListing("std::map<int, FooTemplate<int>*> dummy_member[1];"));
}
void varid_templateNamespaceFuncPtr() {
ASSERT_EQUALS("\n\n##file 0\n"
"1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT<float, &NIFFile::getFloat> mKeyList[4];"));
}
void varidclass1() {
const std::string actual = tokenizeDebugListing(
"class Fred\n"