cppcheck
cppcheck copied to clipboard
fix #10305 & #10699: FP unusedStructMember with aggregate initialization
Compares number of non-static members with number of entries in braced initializer.
10699 Can be added to title as it's pretty much the same.
In my humble opinion here is a better test case. There should be no "unusedStructMember" warning here:
struct S {
int a;
};
S foo() {
return S{0};
}
I realize know that this doesn't actually solve the main in example in #10305 (only the simpler one in the comments), since it relies on the name of the struct appearing before the braced initalizer. So this will require some more work.