digitalmars.D.bugs - [Issue 10578] New: Postfix AA increment not considered side-effect
- d-bugmail puremagic.com (36/36) Jul 08 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10578
http://d.puremagic.com/issues/show_bug.cgi?id=10578 Summary: Postfix AA increment not considered side-effect Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: hsteoh quickfur.ath.cx CODE: ----SNIP---- import std.stdio; struct S { int x; ref S opUnary(string op)() if (op=="++") { x++; return this; } } void main() { S[int] aa; aa[0]++; // this is line 14 writeln(aa[0]); } ----SNIP---- DMD git HEAD (88b794d0) output: test.d(14): Error: var has no effect in expression (__pitmp1583) Changing aa[0]++ to ++aa[0] makes the problem go away. The error is wrong, since postfix ++ is a side-effect. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 08 2013