Fixed #3086 (false positive: Boolean result is used in bitwise operation.)

This commit is contained in:
Daniel Marjamäki 2011-09-11 09:46:01 +02:00
parent 9a97fbe022
commit 55230baf78
2 changed files with 4 additions and 1 deletions

View File

@ -195,7 +195,7 @@ void CheckOther::clarifyCondition()
if (Token::Match(tok2, "[&|^]")) if (Token::Match(tok2, "[&|^]"))
{ {
// don't write false positives when templates are used // don't write false positives when templates are used
if (Token::Match(tok, "<|>") && !code_is_c() && tok2->str() == "&") if (Token::Match(tok, "<|>") && Token::Match(tok2, "& ,|>"))
continue; continue;
clarifyConditionError(tok,false,true); clarifyConditionError(tok,false,true);

View File

@ -2828,6 +2828,9 @@ private:
check("void f() { A<x &> a; }"); check("void f() { A<x &> a; }");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("class A<B&,C>;", "test.C");
ASSERT_EQUALS("", errout.str());
check("void f() {\n" check("void f() {\n"
" if (result != (char *)&inline_result) { }\n" " if (result != (char *)&inline_result) { }\n"
"}"); "}");