digitalmars.D.bugs - [Issue 7733] New: [tdpl] opIndexUnary not called with postfix increment/decrement operators
- d-bugmail puremagic.com (32/32) Mar 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7733
- d-bugmail puremagic.com (6/6) Mar 19 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7733
- d-bugmail puremagic.com (10/10) Mar 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7733
- d-bugmail puremagic.com (12/12) Jul 26 2012 http://d.puremagic.com/issues/show_bug.cgi?id=7733
http://d.puremagic.com/issues/show_bug.cgi?id=7733 Summary: [tdpl] opIndexUnary not called with postfix increment/decrement operators 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 struct S { int[] data; void opIndex(size_t i) { return data[i]; } void opIndexUnary(string op)(size_t i) { return mixin(op ~ "data[i]"); } } void main() { S s; s.data = [1,2,3]; ++s[0]; // OK s[0]++; // Error: s.opIndex(1u) is not an lvalue } This contradicts the specs, that specify that x++ is translated to ++x, which should cause opIndexUnary!"++" to be called, not opIndex. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7733 Oops, typo in previous post: should be int opIndex(size_t i), not void. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 19 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7733 TDPL references: p.378: "Postincrement and postdecrement are generated automatically from preincrement and predecrement, as described in § 12.2.2 on page 369. p.369: describes the rewriting of x++ as ++x when the value is not needed, and as ((ref x){auto t=x; ++x; return t;})(a) when the value is needed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 20 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7733 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |monarchdodra gmail.com Resolution| |DUPLICATE *** This issue has been marked as a duplicate of issue 5044 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 26 2012