Bug 8824 – std.container.Array fails to instantiate Array!char
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-15T05:29:21Z
Last change time
2020-03-21T03:56:32Z
Assigned to
monarchdodra
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2012-10-15T05:29:21Z
Trying to create an actual container (Array) of char elements fails.
This is because the allocated payload creates a char[], which is seen as a "string", as opposed to a "array of char".
The consequence is that it makes two calls choke:
1) Inside linearRemove: "copy" fails to operate on strings (good thing too).
2) Inside Payload.length: It calls initializeAll, which also fails on strings (arguably a good thing...?).
The work around is to simply use Array!dchar or Array!(u)byte.
While one could argue that Array!char *should* work, I do not think it is (currently) worth the effort.
Filling a bug report anyways.
Comment #1 by monarchdodra — 2012-10-17T01:39:33Z
(In reply to comment #0)
> Trying to create an actual container (Array) of char elements fails.
>
> This is because the allocated payload creates a char[], which is seen as a
> "string", as opposed to a "array of char".
>
> The consequence is that it makes two calls choke:
> 1) Inside linearRemove: "copy" fails to operate on strings (good thing too).
> 2) Inside Payload.length: It calls initializeAll, which also fails on strings
> (arguably a good thing...?).
>
> The work around is to simply use Array!dchar or Array!(u)byte.
>
> While one could argue that Array!char *should* work, I do not think it is
> (currently) worth the effort.
>
> Filling a bug report anyways.
Actually, I found a way to easily fix this.
Assigning to self.