Fixed #4145
This commit is contained in:
parent
50f9dd52ab
commit
623ffe23f0
|
@ -265,7 +265,8 @@ void Variables::write(unsigned int varid, const Token* tok)
|
|||
|
||||
if (usage) {
|
||||
usage->_write = true;
|
||||
usage->_read = false;
|
||||
if (!usage->_var->isStatic())
|
||||
usage->_read = false;
|
||||
usage->_lastAccess = tok;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2901,6 +2901,14 @@ private:
|
|||
" return x ? a : c;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:6]: (style) Variable 'b' is assigned a value that is never used\n", errout.str());
|
||||
|
||||
functionVariableUsage("void foo()\n"
|
||||
"{\n"
|
||||
" static int i = 0;\n"
|
||||
" if(i < foo())\n"
|
||||
" i += 5;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvarextern() {
|
||||
|
|
Loading…
Reference in New Issue