Ticket #10028: Properly simplify auto variables' initialization. (#3079)

This commit is contained in:
Simon Martin 2021-01-23 17:56:58 +01:00 committed by GitHub
parent fa30464a96
commit 9d10f4f572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -7529,7 +7529,7 @@ Token * Tokenizer::initVar(Token * tok)
return tok; return tok;
tok = tok->next(); tok = tok->next();
} else if (!tok->isStandardType() && tok->next()->str() != "*") } else if (!tok->isStandardType() && tok->str() != "auto" && tok->next()->str() != "*")
return tok; return tok;
// goto variable name.. // goto variable name..

View File

@ -5013,6 +5013,9 @@ private:
"}\n", "}\n",
true); true);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("void foo() { int f = 0; auto g(f); g = g; }");
ASSERT_EQUALS("", errout.str());
} }
}; };