Fixed #3419 (false positive: (style) Same expression on both sides of '&'.)

This commit is contained in:
Daniel Marjamäki 2011-12-23 16:08:53 +01:00
parent 409364747c
commit e9d697b636
2 changed files with 11 additions and 0 deletions

View File

@ -2646,6 +2646,11 @@ void CheckOther::checkExpressionRange(const std::list<Function> &constFunctions,
unsigned int parantheses = 0; // ()
unsigned int brackets = 0; // []
// taking address?
if (Token::Match(it->second.end->previous(), "%op% &")) {
continue;
}
for (const Token *tok = it->second.start; tok && tok != it->second.end; tok = tok->next()) {
if (tok->str() == "(") {
++parantheses;

View File

@ -2773,6 +2773,12 @@ private:
"}\n"
);
ASSERT_EQUALS("", errout.str());
// #3419
check("void f() {\n"
" if ( &q != &a && &q != &b ) { }\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void secondAlwaysTrueFalseWhenFirstTrueError() {