diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index a7ab263b4..77b09272e 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -851,7 +851,7 @@ void CheckStl::if_find() else if (Token::Match(decl, "%type% >")) { decl = decl->tokAt(2); if (warning && (Token::Match(decl, "* &| %varid%", varid) || - Token::Match(decl, "&| %varid% [ ]| %any% ]| ", varid))) + Token::Match(decl, "&| %varid% [ ]| %any% ]| ", varid))) if_findError(tok, false); } @@ -862,7 +862,7 @@ void CheckStl::if_find() else if (performance && var->isStlStringType()) { decl = decl->next(); if (Token::Match(decl, "* &| %varid%", varid) || - Token::Match(decl, "&| %varid% [ ]| %any% ]| ", varid)) + Token::Match(decl, "&| %varid% [ ]| %any% ]| ", varid)) if_findError(tok, true); } } diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index 21ba08440..a4100f9c6 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -2358,6 +2358,9 @@ private: "void CheckMemoryLeakInFunction::getcode(const Token *tok ) {\n" " addtoken(&rettail, tok);\n" "}"); + const Token *f = Token::findsimplematch(tokenizer.tokens(), "void addtoken ( Token * *"); + ASSERT_EQUALS(true, db && f); + ASSERT_EQUALS(true, db && f && f->function()); }