Bug 16959 – bringToFront fails on char arrays

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-12-08T14:02:00Z
Last change time
2017-01-16T23:26:25Z
Assigned to
razvan.nitu1305
Creator
olaa81

Comments

Comment #0 by olaa81 — 2016-12-08T14:02:10Z
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
Comment #1 by github-bugzilla — 2017-01-05T19:15:00Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/82c30a688260ce13aefee0a12369742ce252ab07 Issue 16959 - Added doc entry about Unicode behaviour + 1 public unittest https://github.com/dlang/phobos/commit/83b25ec626af5c25436afcc7e9f463f762ee5a4a Merge pull request #4970 from RazvanN7/Issue_16959 Fix Issue 16959 - bringToFront fails on char array
Comment #2 by github-bugzilla — 2017-01-07T03:03:28Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/82c30a688260ce13aefee0a12369742ce252ab07 Issue 16959 - Added doc entry about Unicode behaviour + 1 public unittest https://github.com/dlang/phobos/commit/83b25ec626af5c25436afcc7e9f463f762ee5a4a Merge pull request #4970 from RazvanN7/Issue_16959
Comment #3 by github-bugzilla — 2017-01-16T23:26:25Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/82c30a688260ce13aefee0a12369742ce252ab07 Issue 16959 - Added doc entry about Unicode behaviour + 1 public unittest https://github.com/dlang/phobos/commit/83b25ec626af5c25436afcc7e9f463f762ee5a4a Merge pull request #4970 from RazvanN7/Issue_16959