fix regression #1819 (False positive: auto variable assignment (unseen typedef))
This commit is contained in:
parent
3629f953f0
commit
ccb831d375
|
@ -97,7 +97,9 @@ void CheckAutoVariables::autoVariables()
|
|||
//Critical assignment
|
||||
if (Token::Match(tok, "[;{}] * %var% = & %var%") && errorAv(tok->tokAt(2), tok->tokAt(5)))
|
||||
{
|
||||
errorAutoVariableAssignment(tok);
|
||||
const Variable * var = symbolDatabase->getVariableFromVarId(tok->tokAt(5)->varId());
|
||||
if (var && (!var->isClass() || var->type()))
|
||||
errorAutoVariableAssignment(tok);
|
||||
}
|
||||
else if (Token::Match(tok, "[;{}] %var% [ %any% ] = & %var%") && errorAv(tok->tokAt(1), tok->tokAt(7)))
|
||||
{
|
||||
|
|
|
@ -236,7 +236,7 @@ private:
|
|||
" EventPtr event = *eventP;\n"
|
||||
" *actionsP = &event->actions;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Assigning address of local auto-variable to a function parameter.\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void returnLocalVariable1()
|
||||
|
|
Loading…
Reference in New Issue