ValueFlow: Fix crash

This commit is contained in:
Daniel Marjamäki 2022-03-02 21:12:37 +01:00
parent 9c50136571
commit 915ae4b845
2 changed files with 9 additions and 0 deletions

View File

@ -5107,6 +5107,8 @@ static void valueFlowForwardAssign(Token* const tok,
// Skip RHS
const Token * nextExpression = tok->astParent() ? nextAfterAstRightmostLeaf(tok->astParent()) : tok->next();
if (!nextExpression)
return;
for (ValueFlow::Value& value : values) {
if (value.isSymbolicValue())

View File

@ -6397,6 +6397,13 @@ private:
" s;\n"
"}\n";
valueOfTok(code, "s");
code = "int f(int value) { return 0; }\n"
"std::shared_ptr<Manager> g() {\n"
" static const std::shared_ptr<Manager> x{ new M{} };\n"
" return x;\n"
"}\n";
valueOfTok(code, "x");
}
void valueFlowHang() {