Skip to content

Commit

Permalink
fix Issue 5810 - Struct postincrement generates 'no effect' error if …
Browse files Browse the repository at this point in the history
…used on struct member
  • Loading branch information
9rnsr committed May 30, 2014
1 parent 4fbe9f4 commit ffd3ba8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sideeffect.c
Expand Up @@ -208,6 +208,16 @@ void discardValue(Expression *e)
case TOKerror:
return;

case TOKvar:
{
VarDeclaration *v = ((VarExp *)e)->var->isVarDeclaration();
if (v && (v->storage_class & STCtemp))
{
// Bugzilla 5810: Don't complain about an internal generated variable.
return;
}
break;
}
case TOKcall:
/* Issue 3882: */
if (global.params.warnings && !global.gag)
Expand Down
14 changes: 14 additions & 0 deletions test/runnable/opover2.d
Expand Up @@ -822,6 +822,20 @@ void test10037()
assert(lhs == rhs); // lowered to: lhs.value == rhs.value
}

/**************************************/
// 5810

struct Bug5810
{
void opUnary(string op)() {}
}

struct Foo5810
{
Bug5810 x;
void bar() { x++; }
}

/**************************************/
// 6798

Expand Down

0 comments on commit ffd3ba8

Please sign in to comment.