digitalmars.D.bugs - [Issue 21583] New: `array` is not ` safe` for a certain combination
- d-bugmail puremagic.com (43/43) Jan 25 2021 https://issues.dlang.org/show_bug.cgi?id=21583
https://issues.dlang.org/show_bug.cgi?id=21583 Issue ID: 21583 Summary: `array` is not ` safe` for a certain combination of `iota` and data types Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: industry, safe Severity: normal Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: pro.mathias.lang gmail.com I'm fairly certain the following should compile: ``` import std.range, std.array, std.algorithm; safe: struct Block { int[] data; } public struct Height { /// public ulong value; /// Provides implicit conversion to `ulong` public alias value this; } void main () safe { auto x = getBlocksFrom(Height.init); } public auto getBlocksFrom (Height start_height) safe nothrow { auto r = iota(start_height, Height(42)); auto r2 = r.map!(idx => const(Block).init); return r2.array; } ``` Bug disappear if: - The mapping is not to a `const(Block)`; - I pass `ulong` or similar instead of `Height`; - `Block` does not contain an array... Or if it's a `string`; --
Jan 25 2021