Fix ValueFlow crash (#4461)
This commit is contained in:
parent
3887d6dde1
commit
e904f7341e
|
@ -4818,8 +4818,10 @@ static void valueFlowAfterMove(TokenList* tokenlist, SymbolDatabase* symboldatab
|
|||
value.setKnown();
|
||||
|
||||
setTokenValue(tok, value, settings);
|
||||
const Token * const endOfVarScope = var->scope()->bodyEnd;
|
||||
if (var->scope()) {
|
||||
const Token* const endOfVarScope = var->scope()->bodyEnd;
|
||||
valueFlowForward(tok->next(), endOfVarScope, tok, std::move(value), tokenlist);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
ValueFlow::Value::MoveKind moveKind;
|
||||
|
|
|
@ -6789,6 +6789,15 @@ private:
|
|||
" for (b c : {b{}, {}}) {}\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "c");
|
||||
|
||||
code = "class T {\n"
|
||||
"private slots:\n"
|
||||
" void f() { D& r = dynamic_cast<D&>(*m); }\n"
|
||||
" void g() { m.reset(new D); }\n"
|
||||
"private:\n"
|
||||
" std::shared_ptr<B> m;\n"
|
||||
"};\n";
|
||||
valueOfTok(code, "r");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue