Fixed false positive returnTempReference with operator++ (#7874)

This commit is contained in:
PKEuS 2016-12-22 11:49:59 +01:00
parent df5c815b1b
commit ea53bd22b7
2 changed files with 7 additions and 0 deletions

View File

@ -401,6 +401,8 @@ static bool astHasAutoResult(const Token *tok)
return false; return false;
if (tok->isOp()) { if (tok->isOp()) {
if (tok->tokType() == Token::eIncDecOp)
return false;
if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) { if ((tok->str() == "<<" || tok->str() == ">>") && tok->astOperand1()) {
const Token* tok2 = tok->astOperand1(); const Token* tok2 = tok->astOperand1();
while (tok2 && tok2->str() == "*" && !tok2->astOperand2()) while (tok2 && tok2->str() == "*" && !tok2->astOperand2())

View File

@ -1022,6 +1022,11 @@ private:
" return \"foo\" + str;\n" " return \"foo\" + str;\n"
"}"); "}");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("int& incValue(int& value) {\n"
" return ++value;\n"
"}");
ASSERT_EQUALS("", errout.str());
} }
void returnReferenceLambda() { void returnReferenceLambda() {