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

          Issue ID: 16959
           Summary: bringToFront fails on char arrays
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nob...@puremagic.com
          Reporter: ola...@gmail.com

The following code, which is the first example in the docs for
std.algorithm.mutation.bringToFront, but using a char array instead of an int
array:

-- bringToFront.d --
import std.algorithm : bringToFront;

void main(string[] args)
{
  auto arr = ['4', '5', '6', '7', '1', '2', '3'];
  auto p = bringToFront(arr[0 .. 4], arr[4 .. $]);
  assert(p == arr.length - 4);
  assert(arr == ['1', '2', '3', '4', '5', '6', '7']);
}
-- end of file --

fails on compilation with this:

..\src\phobos\std\algorithm\mutation.d(2553): Error: front(r1) is not an lvalue
..\src\phobos\std\algorithm\mutation.d(2554): Error: front(r2) is not an lvalue
..\src\phobos\std\algorithm\mutation.d(134): Error: template instance
std.algorithm.mutation.swapFront!(char[], char[]) error instantiating
bringToFront.d(10):        instantiated from here: bringToFront!(char[],
char[])
..\src\phobos\std\algorithm\mutation.d(2553): Error: function
std.range.Take!(char[]).Take.front () is not callable using argument types
(dchar)
..\src\phobos\std\algorithm\mutation.d(2554): Error: front(r2) is not an lvalue
..\src\phobos\std\algorithm\mutation.d(134): Error: template instance
std.algorithm.mutation.swapFront!(Take!(char[]), char[]) error instantiating
..\src\phobos\std\algorithm\mutation.d(163):        instantiated from here:
bringToFront!(Take!(char[]), char[])
bringToFront.d(10):        instantiated from here: bringToFront!(char[],
char[])

Compiled with rdmd, using dmd v2.072.0

--

Reply via email to