Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used)
This commit is contained in:
parent
126207f3e5
commit
203d3e916b
|
@ -626,9 +626,12 @@ static void eraseMemberAssignments(const unsigned int varId, std::map<unsigned i
|
|||
{
|
||||
const std::map<unsigned int, std::set<unsigned int> >::const_iterator it = membervars.find(varId);
|
||||
if (it != membervars.end()) {
|
||||
const std::set<unsigned int> &v = it->second;
|
||||
for (std::set<unsigned int>::const_iterator vit = v.begin(); vit != v.end(); ++vit)
|
||||
const std::set<unsigned int> v = it->second;
|
||||
for (std::set<unsigned int>::const_iterator vit = v.begin(); vit != v.end(); ++vit) {
|
||||
varAssignments.erase(*vit);
|
||||
if (*vit != varId)
|
||||
eraseMemberAssignments(*vit, membervars, varAssignments);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6417,6 +6417,13 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(struct AB *ab) {\n" // #
|
||||
" ab->data->x = 1;\n"
|
||||
" ab = &ab1;\n"
|
||||
" ab->data->x = 2;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// don't crash
|
||||
check("struct data {\n"
|
||||
" struct { int i; } fc;\n"
|
||||
|
|
Loading…
Reference in New Issue