diff --git a/lib/checkunusedfunctions.cpp b/lib/checkunusedfunctions.cpp index ff79cdd28..e424831fb 100644 --- a/lib/checkunusedfunctions.cpp +++ b/lib/checkunusedfunctions.cpp @@ -175,9 +175,9 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const char Fi funcname = tok->next(); } - else if (Token::Match(tok, "[;{}.,()[=+-/|!?:] &| %var% [(),;:}]")) { + else if (Token::Match(tok, "[;{}.,()[=+-/|!?:] &| %var% [(),;]:}]")) { funcname = tok->next(); - if (tok->str() == "&") + if (funcname->str() == "&") funcname = funcname->next(); } diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index 0b969e81e..6f8555333 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -51,6 +51,7 @@ private: TEST_CASE(attribute); // #3471 - FP __attribute__(constructor) TEST_CASE(initializer_list); TEST_CASE(member_function_ternary); + TEST_CASE(boost); TEST_CASE(multipleFiles); // same function name in multiple files @@ -310,6 +311,12 @@ private: ASSERT_EQUALS("", errout.str()); } + void boost() { + check("static void _xy(const char *b, const char *e)\n" + "{}\n" + "parse(line, blanks_p >> ident[&_xy] >> blanks_p >> eol_p).full"); + ASSERT_EQUALS("", errout.str()); + } void multipleFiles() { CheckUnusedFunctions c;