Bug 8332 – std.Container.Range.opIndexOpAssign does not compile

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-01T10:02:00Z
Last change time
2015-06-09T05:14:53Z
Assigned to
monarchdodra
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2012-07-01T10:02:15Z
Test code: ---- import std.container; void main() { Array!int myList; myList.length = 2; auto range = myList[]; myList[0] += 1; range[0] += 1; //Doesn't compile } ---- ..\..\src\phobos\std\container.d(1758): Error: expression this._outer of type Array!(int) does not have a boolean value ..\..\src\phobos\std\container.d(1758): Error: undefined identifier '_payload' ..\..\src\phobos\std\container.d(1759): Error: undefined identifier '_payload' main.d(10): Error: template instance std.container.Array!(int).Array.Range.opIndexOpAssign!("+") error instantiating ---- Fault is here: ----phobos / std / container.d l. void opIndexOpAssign(string op)(T value, size_t i) { enforce(_outer && _a + i < _b && _b <= _outer._payload.length); mixin("_outer._payload.ptr[_a + i] "~op~"= value;"); } ---- Suggest changing to: ---- void opIndexOpAssign(string op)(T value, size_t i) { enforce(_a + i < _b && _b <= _outer._data._payload.length); mixin("_outer._data._payload.ptr[_a + i] "~op~"= value;"); } ----
Comment #1 by monarchdodra — 2012-07-31T04:01:19Z
Comment #2 by github-bugzilla — 2012-09-16T19:38:53Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/caad7c5017a30d7d5afbe8ae7a7692d7cdd47b5e Merge pull request #764 from monarchdodra/bug8332 Fixes for issues 8332 and 8333 (try 2)
Comment #3 by monarchdodra — 2012-09-17T14:25:55Z
Fixed