Fixed #7583 (Defect: False positive '(error) Reference to temporary returned')
This commit is contained in:
parent
c1d8fd7f13
commit
f68fa72095
|
@ -482,8 +482,13 @@ void CheckAutoVariables::returnReference()
|
|||
|
||||
// Skip over lambdas
|
||||
tok2 = skipLambda(tok2);
|
||||
if (!tok2)
|
||||
break;
|
||||
|
||||
if (!tok2 || tok2->str() != "return")
|
||||
if (tok2->str() == "(")
|
||||
tok2 = tok2->link();
|
||||
|
||||
if (tok2->str() != "return")
|
||||
continue;
|
||||
|
||||
// return..
|
||||
|
|
|
@ -1048,6 +1048,12 @@ private:
|
|||
"return s_var;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #7583
|
||||
check("Command& foo() {\n"
|
||||
" return f([]() -> int { return 1; });\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void returnReferenceInnerScope() {
|
||||
|
|
Loading…
Reference in New Issue