Fix #13944 FN constParameterPointer in method in derived class#8240
Fix #13944 FN constParameterPointer in method in derived class#8240ceJce wants to merge 4 commits intodanmar:mainfrom
Conversation
|
IMHO we should follow the approach used for https://trac.cppcheck.net/ticket/13282 |
Can you clarify what you object of? The inconclusion part or the warning? Before it was no warning at all, now there is but inconclusive is added since the check failed to find the base class. The inconclusion part was suggested by Daniel M. |
| if (foundAllBaseClasses) //If we've seen all the base classes and none of the above were true then it must not be virtual | ||
| return false; | ||
| return defaultVal; //If we can't see all the bases classes then we can't say conclusively | ||
| //If we can't see all the bases classes then we can't say conclusively, set inconclusive (if possible) and return default value |
There was a problem hiding this comment.
Isn't inconclusive redundant since there is pFoundAllBaseClasses already?
The warning should have the "either ... or" format, and be inconclusive. |
|
I agree the warning message can be clarified and it would be good to be somewhat consistent.. |
a5a7044 to
04b4e37
Compare
Add inconclusive and default=false (instead of true) in checkConstPointer.
04b4e37 to
81ef7f1
Compare
Changed so that error message is in format "either ... or can be const" format. Added testcase with override, i.e. no warning.
|



class C : public QObject
{
public:
void func01(QPoint* pt) { // <- pt can be const
if (nullptr == pt) {}
}
};
The fix adds inconclusive warning for this case, including tests.