Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
February 01, 2022 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 Temtaime <temtaime@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Cannot allocate a slice |Cannot allocate a slice on | |heap -- |
February 01, 2022 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |moonlightsentinel@disroot.o | |rg Severity|major |normal --- Comment #1 from moonlightsentinel@disroot.org --- Allocating slices by themselves is explicitly disallowed due to the ambiguitee possibilitly IIUC (you almost always want to allocate the actual array). run.dlang.io shows the degradation of the error message: Up to 2.078.1: Failure with output: onlineapp.d(3): Error: new can only create structs, dynamic arrays or class objects, not ubyte[]'s 2.079.1 to 2.090.1: Failure with output: onlineapp.d(3): Error: new can only create structs, dynamic arrays or class objects, not `ubyte[]`'s 2.091.1 to 2.093.1: Failure with output: onlineapp.d(3): Error: cannot create a `ubyte[]` with `new` Since 2.094.1: Failure with output: onlineapp.d(3): Error: missing length argument for array The error message probably complain about the type + suggest adding a length (which should be the solution in most cases) -- |
February 02, 2022 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com --- Comment #2 from Basile-z <b2.temp@gmx.com> --- Isn't the issue more like a request to have a way to allocate the slice payload on the heap ? Maybe a druntime template should be added for that rare usage, e.g ``` auto newHeapArray(T)() { import core.memory : GC; alias RT = T[]; return cast(RT*) GC.malloc(RT.sizeof, 0, typeid(T[])); } ``` -- |
February 02, 2022 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 --- Comment #3 from Basile-z <b2.temp@gmx.com> --- better with calloc of course -- |
December 17, 2022 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 22723] Cannot allocate a slice on heap | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22723 --- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18082 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation