From e44ee280bcf2a694d946801bbf2717d3e7a64fb6 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sun, 4 Nov 2012 11:15:03 +0100 Subject: [PATCH] Fixed handling of pointers to functions in namespace as template parameters (#4172) --- lib/templatesimplifier.cpp | 2 +- test/testtokenize.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index cf86990f0..d80c68c97 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -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:: diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 796eb743b..b50f12740 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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*> dummy_member[1];")); } + void varid_templateNamespaceFuncPtr() { + ASSERT_EQUALS("\n\n##file 0\n" + "1: KeyListT < float , & NIFFile :: getFloat > mKeyList@1 [ 4 ] ;\n", tokenizeDebugListing("KeyListT mKeyList[4];")); + } + void varidclass1() { const std::string actual = tokenizeDebugListing( "class Fred\n"