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

          Issue ID: 13162
           Summary: std.algorithm.group accepts immutable(char)[] but not
                    immutable(ubyte)[]
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nob...@puremagic.com
          Reporter: bearophile_h...@eml.cc

void main() {
    import std.algorithm: group;
    import std.string: representation;
    immutable(char)[] a1 = "111000";
    a1.group; // OK
    ubyte[] a2 = [1, 1, 1, 0, 0, 0];
    a2.group; // OK
    immutable(ubyte)[] a3 = [1, 1, 1, 0, 0, 0];
    a3.group; // Error
    a1.representation.group; // Error
}


dmd 2.066beta4 gives:

...\dmd2\src\phobos\std\algorithm.d(4031,13): Error: cannot modify struct
this._current Tuple!(immutable(ubyte), uint) with immutable members
test.d(9,7): Error: template instance std.algorithm.group!("a == b",
immutable(ubyte)[]) error instantiating
...\dmd2\src\phobos\std\algorithm.d(4063,13): Error: cannot modify struct
ret._current Tuple!(immutable(ubyte), uint) with immutable members
...\dmd2\src\phobos\std\algorithm.d(4070,1): Error: template instance
std.algorithm.Group!("a == b", immutable(ubyte)[]) error instantiating
test.d(9,7):        instantiated from here: group!("a == b",
immutable(ubyte)[])

--

Reply via email to