Inspection "missing return" not working
已回答
Hi there,
when I have a method that is defined to return nothing and try to return something, that inspeticons shows up as expected. The other way around, having a method defined returning an int for example without a return statement in it, nothing shows up. Checked that the inspection is enabled and also reinstalled CLion so far. But still the missing return isn't recognized by inspections. It is in other IDEs (PS or IJ) ...
Any idea?
Thanks, H
请先登录再写评论。
Hi!
Could you please specify the version of CLion that you use?
I didn't manage to reproduce the issue with CLion 2017.2.3. The warning is on its place (the closing curly brace is highlighted):
And intentions are also there:
it is 2017.2.3, see below
I'm using the Toolbox to install and have currently on my system: PS, IJ, CL and DG.
Regards, H
Hannes, thank you very much for the screenshot! I've reproduced the situation on Windows 10 machine and created the issue in our tracker. Please feel free to comment or upvote.
Hannes, sorry for the confusion! We've made some additional tests and it turned out that this behaviour is caused by the complier specifics: the gcc compiler doesn't show this warning by default, by it does show this warning if the -Wall flag is set. To set this flag you can add the following lines to your CMakeLists.txt file:
Just in case: you can turn this particular warning into an error using the -Werror=return-type flag if you need.
There is a very detailed comment on stackoverflow related to this topic.