[Issue 17264] New: uniq fails with const elements

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Mar 17 12:28:46 PDT 2017


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 at puremagic.com
          Reporter: elpenguino+D at 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

--


More information about the Digitalmars-d-bugs mailing list