Fixed false positive #6575
This commit is contained in:
parent
c8bee3e1a6
commit
9bafa3bf25
|
@ -1420,6 +1420,8 @@ const Token *Token::getValueTokenDeadPointer() const
|
|||
const Variable * const var = vartok->variable();
|
||||
if (var->isStatic() || var->isReference())
|
||||
continue;
|
||||
if (var->scope()->type == Scope::eUnion && var->scope()->nestedIn == this->scope())
|
||||
continue;
|
||||
// variable must be in same function (not in subfunction)
|
||||
if (functionscope != getfunctionscope(var->scope()))
|
||||
continue;
|
||||
|
|
|
@ -3912,6 +3912,17 @@ private:
|
|||
" dosth();\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:7]: (error) Dead pointer usage. Pointer 'former_hover' is dead if it has been assigned '&item' at line 5.\n", errout.str());
|
||||
|
||||
// #6575
|
||||
checkDeadPointer("void trp_deliver_signal() {\n"
|
||||
" union {\n"
|
||||
" Uint32 theData[25];\n"
|
||||
" EventReport repData;\n"
|
||||
" };\n"
|
||||
" EventReport * rep = &repData;\n"
|
||||
" rep->setEventType(NDB_LE_Connected);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue