[Issue 20929] New: std.experimental.allocator.expandArray's range-based overload fails to instantiate for char and wchar arrays.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 14 17:22:47 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20929
Issue ID: 20929
Summary: std.experimental.allocator.expandArray's range-based
overload fails to instantiate for char and wchar
arrays.
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: dbugreporter at harrygillanders.com
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.
--
More information about the Digitalmars-d-bugs
mailing list