Fix #11234 Broken AST with auto**, FP constStatement (#4339)

This commit is contained in:
chrchr-github 2022-08-03 19:03:38 +02:00 committed by GitHub
parent 0eabe0505b
commit a62c3ea90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -1739,7 +1739,7 @@ void CheckOther::charBitOpError(const Token *tok)
static bool isType(const Token * tok, bool unknown)
{
if (tok && (tok->isStandardType() || (!tok->isKeyword() && Token::Match(tok, "%type%"))))
if (tok && (tok->isStandardType() || (!tok->isKeyword() && Token::Match(tok, "%type%")) || tok->str() == "auto"))
return true;
if (Token::simpleMatch(tok, "::"))
return isType(tok->astOperand2(), unknown);

View File

@ -677,6 +677,11 @@ private:
ASSERT_EQUALS("[test.cpp:2]: (warning, inconclusive) Found suspicious operator '+', result is not used.\n"
"[test.cpp:5]: (warning, inconclusive) Found suspicious operator '+', result is not used.\n",
errout.str());
check("void f(XMLElement& parent) {\n" // #11234
" auto** elem = &parent.firstChild;\n"
"}\n", /*inconclusive*/ true);
ASSERT_EQUALS("", errout.str());
}
void vardecl() {