Fixed #3419 (false positive: (style) Same expression on both sides of '&'.)
This commit is contained in:
parent
409364747c
commit
e9d697b636
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue