Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template)
This commit is contained in:
parent
eea0974a5d
commit
66227c4da0
|
@ -189,6 +189,15 @@ void CheckOther::clarifyCondition()
|
|||
Token::simpleMatch(tok2->previous(), "const &")))
|
||||
continue;
|
||||
|
||||
// #3609 - CWinTraits<WS_CHILD|WS_VISIBLE>::..
|
||||
if (Token::Match(tok->previous(), "%var% <")) {
|
||||
const Token *tok3 = tok2;
|
||||
while (Token::Match(tok3, "[&|^] %var%"))
|
||||
tok3 = tok3->tokAt(2);
|
||||
if (Token::Match(tok3, ",|>"))
|
||||
continue;
|
||||
}
|
||||
|
||||
clarifyConditionError(tok,false,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ private:
|
|||
TEST_CASE(clarifyCondition2); // if (a & b == c)
|
||||
TEST_CASE(clarifyCondition3); // if (! a & b)
|
||||
TEST_CASE(clarifyCondition4); // ticket #3110
|
||||
TEST_CASE(clarifyCondition5); // #3609 CWinTraits<WS_CHILD|WS_VISIBLE>..
|
||||
TEST_CASE(bitwiseOnBoolean); // if (bool & bool)
|
||||
|
||||
TEST_CASE(comparisonOfBoolExpressionWithInt1);
|
||||
|
@ -3541,6 +3542,11 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void clarifyCondition5() { // ticket #3609 (using | in template instantiation)
|
||||
check("CWinTraits<WS_CHILD|WS_VISIBLE>::GetWndStyle(0);");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void bitwiseOnBoolean() { // 3062
|
||||
check("void f(_Bool a, _Bool b) {\n"
|
||||
" if(a & b) {}\n"
|
||||
|
|
Loading…
Reference in New Issue