Fix crash in valueFlowForwardLifetime() (#4891)
This commit is contained in:
parent
319baf8d0f
commit
716fcc5e96
|
@ -3854,7 +3854,7 @@ static void valueFlowForwardLifetime(Token * tok, TokenList *tokenlist, ErrorLog
|
|||
valueFlowLifetimeFunction(parent->previous(), tokenlist, errorLogger, settings);
|
||||
valueFlowForwardLifetime(parent, tokenlist, errorLogger, settings);
|
||||
// Variable
|
||||
} else if (tok->variable()) {
|
||||
} else if (tok->variable() && tok->variable()->scope()) {
|
||||
const Variable *var = tok->variable();
|
||||
const Token *endOfVarScope = var->scope()->bodyEnd;
|
||||
|
||||
|
|
|
@ -6896,6 +6896,11 @@ private:
|
|||
" const C& c = C(b) ? : C(false);\n"
|
||||
"};\n";
|
||||
valueOfTok(code, "?");
|
||||
|
||||
code = "struct S {\n"
|
||||
" void g(std::vector<int> (*f) () = nullptr);\n"
|
||||
"};\n";
|
||||
valueOfTok(code, "=");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue