Thread overview
[Issue 21583] `array` is not `@safe` for a certain combination of `iota` and data types
May 02, 2021
Berni44
Dec 17, 2022
Iain Buclaw
May 02, 2021
https://issues.dlang.org/show_bug.cgi?id=21583

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@bernis-buecher.de

--- Comment #1 from Berni44 <bugzilla@bernis-buecher.de> ---
The reason is the cast() here:

emplaceRef!(Unqual!T)(bigData[len], cast() item);

found in std.array:

https://github.com/dlang/phobos/blob/a1ee4fd4fd02529f5849e317fe9eccb8280f4b37/std/array.d#L3466

(Error: cast from `const(Block)` to `Block` not allowed in safe code)



If it is replaced by

emplaceRef!(Unqual!T)(bigData[len], () @trusted { return cast() item; }() );

the example works. But I'm not sure if I want to trust that cast...

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=21583

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=21583

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10454

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--