While using the latest cppcheck I found an issue with the following error
error: Syntax Error: AST broken, 'if' doesn't have two operands. [internalAstError] This error happens when I do the following
HANDLE fileHandle = INVALID_HANDLE_VALUE; auto func = call_to_fun([&fileHandle]() { if (fileHandle != INVALID_HANDLE_VALUE) closeHandle(fileHandle) });
I was looking in the cppcheck code in tokenlist.cpp in order to see what's wrong. It looks like this shouldn't be a problem as it is lembda. In fact, if I move the code little bit
HANDLE fileHandle = INVALID_HANDLE_VALUE; auto lembda_func = [&fileHandle]() { if (fileHandle != INVALID_HANDLE_VALUE) closeHandle(fileHandle) }; auto func = call_to_fun(lembda_func);
So i'm not sure if i'm doing it wrong or it is actually a bug in cppcheck 1.90
Probably a Cppcheck bug. Can you please provide a small example code that reproduce the problem?
This maybe related to this bug here:
https://trac.cppcheck.net/ticket/9537
Yep, this is the same problem. Thanks guys. Hoping to see it get fixed, I may look into it myself :-)
Log in to post a comment.
While using the latest cppcheck I found an issue with the following error
I was looking in the cppcheck code in tokenlist.cpp in order to see what's wrong. It looks like this shouldn't be a problem as it is lembda. In fact, if I move the code little bit
So i'm not sure if i'm doing it wrong or it is actually a bug in cppcheck 1.90
Last edit: Adnan Shaheen 2020-02-14
Probably a Cppcheck bug. Can you please provide a small example code that reproduce the problem?
This maybe related to this bug here:
https://trac.cppcheck.net/ticket/9537
Yep, this is the same problem. Thanks guys. Hoping to see it get fixed, I may look into it myself :-)