Bug 13162 – std.algorithm.group accepts immutable(char)[] but not immutable(ubyte)[]

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-07-19T19:17:00Z
Last change time
2014-12-14T16:36:46Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-07-19T19:17:40Z
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)[])
Comment #1 by peter.alexander.au — 2014-12-14T16:36:46Z
*** This issue has been marked as a duplicate of issue 10104 ***