parent
8cc7131ee9
commit
e1db4c0e2c
|
@ -1976,9 +1976,9 @@ void CheckOther::checkDuplicateExpression()
|
|||
}
|
||||
}
|
||||
} else if (styleEnabled &&
|
||||
isOppositeCond(true, _tokenizer->isCPP(), tok->astOperand1(), tok->astOperand2(), _settings->library, false) &&
|
||||
!Token::simpleMatch(tok, "=") &&
|
||||
isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand1())) {
|
||||
isOppositeCond(true, _tokenizer->isCPP(), tok->astOperand1(), tok->astOperand2(), _settings->library, false) &&
|
||||
!Token::simpleMatch(tok, "=") &&
|
||||
isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand1())) {
|
||||
oppositeExpressionError(tok, tok, tok->str());
|
||||
} else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative
|
||||
if (styleEnabled && tok->astOperand2() && tok->str() == tok->astOperand1()->str() && isSameExpression(_tokenizer->isCPP(), true, tok->astOperand2(), tok->astOperand1()->astOperand2(), _settings->library, true) && isWithoutSideEffects(_tokenizer->isCPP(), tok->astOperand2()))
|
||||
|
|
|
@ -947,13 +947,13 @@ private:
|
|||
}
|
||||
|
||||
void doublefree9() {
|
||||
check("struct foo {\n"
|
||||
" int* get(int) { return new int(); }\n"
|
||||
"};\n"
|
||||
"void f(foo* b) {\n"
|
||||
" std::unique_ptr<int> x(b->get(0));\n"
|
||||
" std::unique_ptr<int> y(b->get(1));\n"
|
||||
"}\n", true);
|
||||
check("struct foo {\n"
|
||||
" int* get(int) { return new int(); }\n"
|
||||
"};\n"
|
||||
"void f(foo* b) {\n"
|
||||
" std::unique_ptr<int> x(b->get(0));\n"
|
||||
" std::unique_ptr<int> y(b->get(1));\n"
|
||||
"}\n", true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue