Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 0 additions & 2 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3091,8 +3091,6 @@ static const Token* findExpressionChangedImpl(const Token* expr,
}
bool global = false;
if (tok->variable()) {
if (tok->variable()->isConst())
return false;
global = !tok->variable()->isLocal() && !tok->variable()->isArgument() &&
!(tok->variable()->isMember() && !tok->variable()->isStatic());
} else if (tok->isIncompleteVar() && !tok->isIncompleteConstant()) {
Expand Down
11 changes: 11 additions & 0 deletions test/testcondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5882,6 +5882,17 @@ class TestCondition : public TestFixture {
" if (strlen(s2) > 0) {}\n"
"}\n");
ASSERT_EQUALS("", errout_str());

check("void g(int*);\n" // #14428
Comment thread
chrchr-github marked this conversation as resolved.
"int f(int* const p) {\n"
" int i = 0;\n"
" if (*p == 0)\n"
" g(p);\n"
" if (*p == 0)\n"
" i = 1;\n"
" return i;\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void checkInvalidTestForOverflow() {
Expand Down
Loading