www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17264] New: uniq fails with const elements

https://issues.dlang.org/show_bug.cgi?id=17264

          Issue ID: 17264
           Summary: uniq fails with const elements
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

The fix for issue 16588 causes code like

const(int)[] var = [0, 1, 1, 2];
assert(var.uniq.equal([0,1,2]));

to result in errors like

std\algorithm\iteration.d(4967): Error: cannot modify const expression
this._back
std\algorithm\iteration.d(4971): Error: cannot modify const expression last
std\algorithm\iteration.d(4975): Error: cannot modify const expression
this._back

--
Mar 17 2017