Partial fix for 10393: FP returnDanglingLifetime when constructing string from iterators [inconclusive] (#3536)
This commit is contained in:
parent
e20ddd55d6
commit
e998cd13ca
|
@ -6615,8 +6615,13 @@ void SymbolDatabase::setValueTypeInTokenList(bool reportDebugWarnings, Token *to
|
|||
const Scope *functionScope = tok->scope();
|
||||
while (functionScope && functionScope->isExecutable() && functionScope->type != Scope::eLambda && functionScope->type != Scope::eFunction)
|
||||
functionScope = functionScope->nestedIn;
|
||||
if (functionScope && functionScope->type == Scope::eFunction && functionScope->function && functionScope->function->retDef)
|
||||
setValueType(tok, ValueType::parseDecl(functionScope->function->retDef, mSettings));
|
||||
if (functionScope && functionScope->type == Scope::eFunction && functionScope->function &&
|
||||
functionScope->function->retDef) {
|
||||
ValueType vt = ValueType::parseDecl(functionScope->function->retDef, mSettings);
|
||||
setValueType(tok, vt);
|
||||
if (Token::simpleMatch(tok, "return {"))
|
||||
setValueType(tok->next(), vt);
|
||||
}
|
||||
} else if (tok->variable()) {
|
||||
setValueType(tok, *tok->variable());
|
||||
if (!tok->variable()->valueType() && tok->valueType())
|
||||
|
|
|
@ -2456,6 +2456,12 @@ private:
|
|||
" return &*seq.begin();\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("std::string f(std::string Str, int first, int last) {\n"
|
||||
" return { Str.begin() + first, Str.begin() + last + 1 };\n"
|
||||
"}\n",
|
||||
true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void danglingLifetimeContainerView()
|
||||
|
|
Loading…
Reference in New Issue