Skip to content

Commit

Permalink
Update valueflow.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 8, 2024
1 parent 4a69b61 commit b624c9c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/valueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,12 @@ static size_t accumulateStructMembers(const Scope* scope, F f)
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), 1LL, [](MathLib::bigint i1, const Dimension& dim) {
return i1 * dim.num;
});
const auto ret = anonScopes.insert(var.nameToken()->scope());
if (ret.second)
if (var.nameToken()->scope() != scope && var.nameToken()->scope()->definedType) { // anonymous union
const auto ret = anonScopes.insert(var.nameToken()->scope());
if (ret.second)
total = f(total, *vt, dim);
}
else
total = f(total, *vt, dim);
}
if (total == 0)
Expand Down

0 comments on commit b624c9c

Please sign in to comment.