Fix 11076: Assert failure / crash with loop over init list (#4119)
This commit is contained in:
parent
a62fb986a5
commit
feaef46436
|
@ -2050,6 +2050,9 @@ T* getTokenArgumentFunctionImpl(T* tok, int& argn)
|
|||
tok = tok->link()->previous();
|
||||
if (!Token::Match(tok, "%name%|(|{"))
|
||||
return nullptr;
|
||||
// Skip labels
|
||||
if (Token::Match(tok, "%name% :"))
|
||||
return nullptr;
|
||||
return tok;
|
||||
}
|
||||
|
||||
|
|
|
@ -6614,6 +6614,14 @@ private:
|
|||
" }\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "age");
|
||||
|
||||
code = "void a() {\n"
|
||||
" struct b {\n"
|
||||
" int d;\n"
|
||||
" };\n"
|
||||
" for (b c : {b{}, {}}) {}\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "c");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue