Fix 10950: Crash on function declaration (#3979)

* Fix 10950: Crash on function declaration

* Format
This commit is contained in:
Paul Fultz II 2022-04-06 12:00:05 -05:00 committed by GitHub
parent b73aeeda0e
commit bb640c4879
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -7649,6 +7649,8 @@ static void valueFlowContainerSize(TokenList* tokenlist,
for (const Variable *var : symboldatabase->variableList()) {
if (!var)
continue;
if (!var->scope() || !var->scope()->bodyEnd || !var->scope()->bodyStart)
continue;
if (!var->valueType() || !var->valueType()->container)
continue;
if (!astIsContainer(var->nameToken()))

View File

@ -6434,6 +6434,12 @@ private:
" std::cout << (void*)(std::shared_ptr<int>{ g() }.get());\n"
"}\n";
valueOfTok(code, ".");
code = "class T;\n"
"struct S {\n"
" void f(std::array<T*, 2>& a);\n"
"};\n";
valueOfTok(code, "a");
}
void valueFlowHang() {