Fixed false positive returnTempReference with operator++ (#7874)
This commit is contained in:
parent
df5c815b1b
commit
ea53bd22b7
|
@ -401,6 +401,8 @@ static bool astHasAutoResult(const Token *tok)
|
|||
return false;
|
||||
|
||||
if (tok->isOp()) {
|
||||
if (tok->tokType() == Token::eIncDecOp)
|
||||
return false;
|
||||
if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) {
|
||||
const Token* tok2 = tok->astOperand1();
|
||||
while (tok2 && tok2->str() == "*" && !tok2->astOperand2())
|
||||
|
|
|
@ -1022,6 +1022,11 @@ private:
|
|||
" return \"foo\" + str;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int& incValue(int& value) {\n"
|
||||
" return ++value;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void returnReferenceLambda() {
|
||||
|
|
Loading…
Reference in New Issue