Bug 5810 – Struct postincrement generates 'no effect' error if used on struct member

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-04-03T16:33:00Z
Last change time
2014-06-09T04:27:45Z
Keywords
diagnostic, pull, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-04-03T16:33:07Z
import std.bigint; struct Foo { BigInt x; void bar() { x++; } } void main() {} DMD 2.052 shows: test.d(4): Error: var has no effect in expression (__tmp19)
Comment #1 by clugdbug — 2011-05-06T04:17:21Z
It's nothing to do with BigInt. Here's a reduced test case: struct Bug5810 { void opUnary(string op)() { } } struct Foo { Bug5810 x; void bar() { x++; } } test2.d(13): Error: var has no effect in expression (__pitmp4)
Comment #2 by k.hara.pg — 2014-05-30T02:46:24Z
Comment #3 by bearophile_hugs — 2014-05-30T06:35:12Z
I guess Issue 12816 is a dupe
Comment #4 by k.hara.pg — 2014-05-30T07:34:53Z
*** Issue 12816 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2014-05-30T17:58:04Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ffd3ba8dd8741529f6efc215b3c3442f973a4644 fix Issue 5810 - Struct postincrement generates 'no effect' error if used on struct member https://github.com/D-Programming-Language/dmd/commit/6e820f902a136f0a574deb4bf2f0ada86fe44047 Merge pull request #3605 from 9rnsr/fix5810 Issue 5810 - Struct postincrement generates 'no effect' error if used on struct member
Comment #6 by k.hara.pg — 2014-06-09T04:27:45Z
*** Issue 10578 has been marked as a duplicate of this issue. ***