[Issue 12323] std.typecons.Nullable of a fixed-size array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 12 22:06:42 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=12323

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Nick Treleaven <nick at geany.org> ---
Sorry, the error messages are different now:

nullableslice.d(10): Error: constructor
`std.typecons.Nullable!(int[5]).Nullable.this(inout(int[5]) value) inout` is
not callable using argument types `(int[])`
nullableslice.d(10):        cannot pass argument `array(iota(5))` of type
`int[]` to parameter `inout(int[5]) value`
nullableslice.d(13): Error: constructor
`std.typecons.Nullable!(int[5]).Nullable.this(inout(int[5]) value) inout` is
not callable using argument types `(immutable(int)[])`
nullableslice.d(13):        cannot pass argument `idup(array(iota(5)))` of type
`immutable(int)[]` to parameter `inout(int[5]) value`

That is actually correct because the type system can't know at compile-time
that `array` or `idup` will each return a slice that has 5 elements.

--


More information about the Digitalmars-d-bugs mailing list