Fix crash in valueflow when using local classes (#2575)
This commit is contained in:
parent
a171f524cf
commit
b68d6f9471
|
@ -46,6 +46,10 @@ struct ForwardTraversal {
|
|||
return Progress::Break;
|
||||
if (out)
|
||||
*out = lambdaEndToken;
|
||||
// Skip class scope
|
||||
} else if (Token::simpleMatch(tok, "{") && tok->scope() && tok->scope()->isClassOrStruct()) {
|
||||
if (out)
|
||||
*out = tok->link();
|
||||
} else {
|
||||
if (f(tok) == Progress::Break)
|
||||
return Progress::Break;
|
||||
|
|
|
@ -4453,6 +4453,14 @@ private:
|
|||
" dostuff(1);\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "x");
|
||||
|
||||
code = "void a() {\n"
|
||||
" static int x = 0;\n"
|
||||
" struct c {\n"
|
||||
" c(c &&) { ++x; }\n"
|
||||
" };\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "x");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue