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;
|
return Progress::Break;
|
||||||
if (out)
|
if (out)
|
||||||
*out = lambdaEndToken;
|
*out = lambdaEndToken;
|
||||||
|
// Skip class scope
|
||||||
|
} else if (Token::simpleMatch(tok, "{") && tok->scope() && tok->scope()->isClassOrStruct()) {
|
||||||
|
if (out)
|
||||||
|
*out = tok->link();
|
||||||
} else {
|
} else {
|
||||||
if (f(tok) == Progress::Break)
|
if (f(tok) == Progress::Break)
|
||||||
return Progress::Break;
|
return Progress::Break;
|
||||||
|
|
|
@ -4453,6 +4453,14 @@ private:
|
||||||
" dostuff(1);\n"
|
" dostuff(1);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "x");
|
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() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue