Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/vf_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ namespace ValueFlow
if (!tok->isTemplateArg())
value.setKnown();
setTokenValue(tok->next(), std::move(value), settings);
} else if (Token::simpleMatch(tok, "= { } ;")) {
} else if (Token::simpleMatch(tok, "= { }")) {
const Token* lhs = tok->astOperand1();
if (lhs && lhs->valueType() && (lhs->valueType()->isIntegral() || lhs->valueType()->pointer > 0)) {
Value value(0);
Expand Down
5 changes: 5 additions & 0 deletions test/testvalueflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6451,6 +6451,11 @@ class TestValueFlow : public TestFixture {
" return x;\n"
"}\n";
ASSERT_EQUALS(true, testValueOfXKnown(code, 5U, 0));

code = "void f() {\n"
" if (int* x = {}) {}\n"
"}\n";
ASSERT_EQUALS(true, testKnownValueOfTok(code, "=", 0));
}

static std::string isPossibleContainerSizeValue(std::list<ValueFlow::Value> values,
Expand Down
Loading