Looks like that cppcheck is confused with the typedef if both conditions are met:
1. typedef with non-primitive data type
2. typedef in base class scope
Is it a possible bug?
Thanks and regards,
David
Last edit: David Lin 2019-03-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I found that cppcheck sometimes not working well with non-primitive typedef.
Version: 1.87
cppcheck --enable=style
With following code snippet, cppcheck can find and emit warning
Howerever,
If Type is defined as std::vector
cppcheck will no longer emit any warnings.
The following are 2 cases that cppcheck will also emit warning.
Case 1:
Case2:
Looks like that cppcheck is confused with the typedef if both conditions are met:
1. typedef with non-primitive data type
2. typedef in base class scope
Is it a possible bug?
Thanks and regards,
David
Last edit: David Lin 2019-03-28
Update:
Lookes like the Type is not correctly deducted from base class's typedef.
But what make me curious is that cppcheck behaves differently by putting typedef out of base class scope.
Shall we have a ticket for this if it is confirmed bug?
I would appreciate if this issue can be fixed.
Thanks,
David
IMHO it is a false negative, so i created a ticket: https://trac.cppcheck.net/ticket/9086
Last edit: versat 2019-04-01
Thank you for confirming this issue.
Thanks,
David