Is there a ReSharper inspection to catch compiler static analysis warning C6216
Hi,
I have a function like this that contains a macro that returns a default value.
#define ASSERT_RETURN(condition, returnValue) \
do \
{ \
if (!(condition)) \
{ \
assert(condition); \
return returnValue;\
}\
}\
while (0)
HRESULT f()
{
const bool test = false;
ASSERT_RETURN(test, false); // warning C6216
return S_OK;
}
If I enable the Visual Studio Static Analysis, I get
C:\work\ConsoleApplication3\ConsoleApplication3.cpp(23): warning C6216: Compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT.
Is there an equivalent ReSharperC++ code analysis to trigger the same warning ?
Thanks.
Please sign in to leave a comment.
Hello,
There's no such inspection at the moment. I've filed it in our issue tracker (https://youtrack.jetbrains.com/issue/RSCPP-30434), but given it's a very specific check we can't promise it'll be of high priority. Thanks for the suggestion though!
Thanks,
We found that while refactoring code and it went to nightly build where it got caught in the Static Analysis build.
Not a big issue.
Maximilien.