Bug 15792 – Error Filling an array

Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-03-12T16:14:53Z
Last change time
2024-12-01T16:26:19Z
Assigned to
No Owner
Creator
Alex
Moved to GitHub: phobos#10166 →

Comments

Comment #0 by sascha.orlov — 2016-03-12T16:14:53Z
Didn't find an existing issue for this. Sorry, if missed. As described here: https://forum.dlang.org/post/[email protected] There is an error during an attempt to fill an array of Nullable!uint during the execution of void main() { import std.typecons; Nullable!uint[] arr; arr.length = 5; arr[] = 1; } The suggested workaround is, currently, using a cast: arr[] = cast(Nullable!uint)1; Also an option would be: import std.algorithm; fill(arr, 1);
Comment #1 by sascha.orlov — 2016-03-12T18:34:11Z
The error is: Error: cannot implicitly convert expression (1) of type int to Nullable!uint[]
Comment #2 by sascha.orlov — 2016-03-12T20:14:13Z
filling via arr[] = Nullable!uint(1); is also possible
Comment #3 by razvan.nitu1305 — 2023-02-13T14:52:17Z
This is not a compiler bug, but at most a phobos one.
Comment #4 by robert.schadek — 2024-12-01T16:26:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10166 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB