Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples)

This commit is contained in:
Daniel Marjamäki 2012-05-22 19:01:21 +02:00
parent 5b0551054a
commit 77e9106ec0
2 changed files with 13 additions and 0 deletions

View File

@ -2878,6 +2878,12 @@ void CheckOther::checkComparisonOfBoolExpressionWithInt()
const SymbolDatabase* symbolDatabase = _tokenizer->getSymbolDatabase();
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
// Skip template parameters
if (tok->str() == "<" && tok->link()) {
tok = tok->link();
continue;
}
const Token* numTok = 0;
const Token* opTok = 0;
char op = 0;

View File

@ -124,6 +124,7 @@ private:
TEST_CASE(comparisonOfBoolExpressionWithInt1);
TEST_CASE(comparisonOfBoolExpressionWithInt2);
TEST_CASE(comparisonOfBoolExpressionWithInt3);
TEST_CASE(incorrectStringCompare);
@ -3041,6 +3042,12 @@ private:
ASSERT_EQUALS("", errout.str());
}
void comparisonOfBoolExpressionWithInt3() {
check("int f(int x) {\n"
" return t<0>() && x;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void memsetZeroBytes() {
check("void f() {\n"