www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19981] New: std.algorithm.iteration.group fails when element

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

          Issue ID: 19981
           Summary: std.algorithm.iteration.group fails when element type
                    has a const/immutable member
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

```
unittest {
    import std.algorithm.iteration : group;
    static struct X {
        const int x;
    }
    X[] arr = [X(1),X(2),X(3)];
    group(arr);
}
```
Currently (DMD 2.086.1) this produces an unhelpful error: Error: cannot modify
struct instance `this._current` of type `Tuple!(X, uint)` because it contains
`const` or `immutable` members

--
Jun 18 2019