Fixed #2330 (unreadVariable error for a fstream object when only extraction operator (>>) is used)
This commit is contained in:
parent
244974a61a
commit
0f9415a5fb
|
@ -1732,6 +1732,8 @@ void CheckOther::functionVariableUsage()
|
|||
|
||||
else if (Token::Match(tok, ">>|& %var%"))
|
||||
variables.use(tok->next()->varId()); // use = read + write
|
||||
else if (Token::Match(tok, "[;{}] %var% >>"))
|
||||
variables.use(tok->next()->varId()); // use = read + write
|
||||
|
||||
// function parameter
|
||||
else if (Token::Match(tok, "[(,] %var% ["))
|
||||
|
|
|
@ -1335,11 +1335,11 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
void localvar32() // ticket #2330
|
||||
{
|
||||
functionVariableUsage("void f() {\n"
|
||||
" int x;\n"
|
||||
" int x;\n"
|
||||
" fstream &f = getfile();\n"
|
||||
" f >> x;\n"
|
||||
"}\n");
|
||||
|
|
Loading…
Reference in New Issue