Fixed #6482 (False positive multiCondition)

This commit is contained in:
Daniel Marjamäki 2015-02-01 12:58:06 +01:00
parent b74b94b1e6
commit d091639080
2 changed files with 7 additions and 1 deletions

View File

@ -286,7 +286,7 @@ static bool isOverlappingCond(const Token * const cond1, const Token * const con
const MathLib::bigint value1 = MathLib::toLongNumber(num1->str());
const MathLib::bigint value2 = MathLib::toLongNumber(num2->str());
return ((value1 & value2) == value2);
return (value2 > 0 && (value1 & value2) == value2);
}
return false;
}

View File

@ -451,6 +451,12 @@ private:
" else if (dynamic_cast<LABEL*>(widget)){}\n"
"}",false);
ASSERT_EQUALS("", errout.str());
check("void f(int x) {\n" // #6482
" if (x & 1) {}\n"
" else if (x == 0) {}\n"
"}",false);
ASSERT_EQUALS("", errout.str());
}
void invalidMissingSemicolon() {