Skip to content

Commit

Permalink
fix #13117 FP: unusedFunction: The function 'f' is never used. (danma…
Browse files Browse the repository at this point in the history
  • Loading branch information
ludviggunne authored Sep 24, 2024
1 parent a92d852 commit 64bd633
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/checkunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer, const Setting
while (Token::Match(funcname, "%name% :: %name%"))
funcname = funcname->tokAt(2);

if (!Token::Match(funcname, "%name% [(),;]:}>]"))
if (!Token::Match(funcname, "%name% [(),;]:}<>]"))
continue;
}

Expand Down
11 changes: 11 additions & 0 deletions test/testunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ class TestUnusedFunctions : public TestFixture {
" return 0\n"
"}");
ASSERT_EQUALS("", errout_str());

check("template <class T> T f()\n" // #13117
"{\n"
" return T(1);\n"
"}\n"
"int main(void)\n"
"{\n"
" auto *ptr = &f<int>;\n"
" return ptr();\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void template1() {
Expand Down

0 comments on commit 64bd633

Please sign in to comment.