Fixed #1813 (false negative: Member variable not assigned a value in operator=)

This commit is contained in:
Robert Reif 2010-06-25 07:52:12 +02:00 committed by Daniel Marjamäki
parent 9fd89d3bdc
commit 38f90dae09
2 changed files with 14 additions and 1 deletions

View File

@ -4312,7 +4312,7 @@ bool Tokenizer::simplifyQuestionMark()
{
if (endTok->str() == ";")
{
Token::eraseTokens(semicolon->previous(), endTok->next());
Token::eraseTokens(semicolon->previous(), endTok);
ret = true;
break;
}

View File

@ -67,6 +67,7 @@ private:
TEST_CASE(localvar19); // ticket #1776
TEST_CASE(localvar20); // ticket #1799
TEST_CASE(localvar21); // ticket #1807
TEST_CASE(localvar22); // ticket #1811
TEST_CASE(localvaralias1);
TEST_CASE(localvaralias2); // ticket #1637
TEST_CASE(localvaralias3); // ticket #1639
@ -1190,6 +1191,18 @@ private:
ASSERT_EQUALS("", errout.str());
}
void localvar22() // ticket #1811
{
functionVariableUsage("int foo(int u, int v)\n"
"{\n"
" int h, i;\n"
" h = 0 ? u : v;\n"
" i = 1 ? u : v;\n"
" return h + i;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}
void localvaralias1()
{
functionVariableUsage("void foo()\n"