ValueFlow: don't reset the struct size if there is a unknown member + empty structs have a size of 1#7560
Conversation
|
Thanks for your contribution. There are situations where the exact size of a type is required, and others (e.g. the passedByValue check) where a lower bound is sufficient. We should probably differentiate this by a flag passed to |
|
We also need to add a test for the referenced ticket. |
Can you point me to the place where I should insert it (in which of the test cases)? |
There is a |
fcda7db to
769cbfe
Compare
Done now. I was not sure what the right flag should be in every context.
Done :) |
bcf58df to
ed219c1
Compare
Btw the current implementation already returned the lower bound if inheritance is used. |
… empty structs have a size of 1
ed219c1 to
6e90e74
Compare
|
@firewave Can you approve the workflow runs? |
Fixes https://trac.cppcheck.net/ticket/13696 + #6257 (comment)
One could argue that the size of a member of an unknown type should be 1 instead of 0 because the member will be at least 1 byte large (if not empty and annotated with
[[no_unique_address]])