Bug 20929 – std.experimental.allocator.expandArray's range-based overload fails to instantiate for char and wchar arrays.
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-14T17:22:47Z
Last change time
2020-06-19T12:57:47Z
Keywords
pull
Assigned to
No Owner
Creator
Harry Gillanders
Comments
Comment #0 by dbugreporter — 2020-06-14T17:22:47Z
If you call `expandArray` on a `char[]` or `wchar[]`, and provide a range from
which to expand the array with, it will fail to instantiate.
Such as with this test-case:
----
unittest
{
import std.experimental.allocator : expandArray, makeArray, theAllocator;
import std.utf : byCodeUnit;
char[] array = theAllocator.makeArray!char(0);
theAllocator.expandArray(array, "foo".byCodeUnit());
assert(array == "foo");
}
----
Which fails to compile with an error message like:
----
std\experimental\allocator\package.d(2228): Error: front(toFill) is not an lvalue and cannot be modified
.\expand_array_bug.d(10): Error: template instance std.experimental.allocator.expandArray!(char, RCIAllocator, ByCodeUnitImpl) error instantiating
----
I've got a PR ready to fix this, which I'll submit after this bug report.
Comment #1 by dlang-bot — 2020-06-14T19:01:53Z
@Just-Harry created dlang/phobos pull request #7530 "Fix issue 20929 - std.experimental.allocator.expandArray's range-based overload fails to instantiate for char and wchar arrays." fixing this issue:
- Fix issue 20929
std.experimental.allocator.expandArray's range-based overload fails to
instantiate for char and wchar arrays.
https://github.com/dlang/phobos/pull/7530
Comment #2 by dlang-bot — 2020-06-19T12:57:47Z
dlang/phobos pull request #7530 "Fix issue 20929 - std.experimental.allocator.expandArray's range-based overload fails to instantiate for char and wchar arrays." was merged into master:
- 86e2d75187f83495cd92b2699f93d8f4ba6e7137 by Harry Gillanders:
Fix issue 20929
std.experimental.allocator.expandArray's range-based overload fails to
instantiate for char and wchar arrays.
https://github.com/dlang/phobos/pull/7530