diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 53595c4ad0e..331cb03be27 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1784,6 +1784,8 @@ static bool isType(const Token * tok, bool unknown) { if (tok && (tok->isStandardType() || (!tok->isKeyword() && Token::Match(tok, "%type%")) || tok->str() == "auto")) return true; + if (tok && tok->varId()) + return false; if (Token::simpleMatch(tok, "::")) return isType(tok->astOperand2(), unknown); if (Token::simpleMatch(tok, "<") && tok->link()) diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index 4be5ef1838c..a19cf6088df 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -666,6 +666,11 @@ class TestIncompleteStatement : public TestFixture { "}\n", /*inconclusive*/ true); ASSERT_EQUALS("[test.cpp:2]: (warning, inconclusive) Found suspicious operator '*', result is not used.\n", errout_str()); + check("void f(int x, int y) {\n" // #12525 + " x * y;\n" + "}\n", /*inconclusive*/ true); + ASSERT_EQUALS("[test.cpp:2]: (warning, inconclusive) Found suspicious operator '*', result is not used.\n", errout_str()); + check("void f() {\n" // #5475 " std::string(\"a\") + \"a\";\n" "}\n"