Bug 12322 – Bad error message with wrong Nullable array argument

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-03-08T14:09:29Z
Last change time
2022-08-22T12:14:58Z
Keywords
diagnostic
Assigned to
No Owner
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-03-08T14:09:29Z
import std.typecons: Nullable; alias Foo = int[5]; alias NFoo = Nullable!Foo; NFoo bar1() { int[] a; return NFoo(a); // Error } NFoo bar2() { immutable int[] b; return NFoo(b); // Error } void main() {} dmd 2.066alpha gives error messages that I think could be better: test.d(6,16): Error: inout method std.typecons.Nullable!(int[5]).Nullable.this is not callable using a mutable object test.d(10,16): Error: inout method std.typecons.Nullable!(int[5]).Nullable.this is not callable using a mutable object
Comment #1 by bearophile_hugs — 2014-03-08T14:12:08Z
See also Issue 12323
Comment #2 by monkeyworks12 — 2015-04-25T22:37:39Z
*** Issue 13016 has been marked as a duplicate of this issue. ***
Comment #3 by razvan.nitu1305 — 2022-08-22T12:14:58Z
The error message is now: test.d(6): Error: constructor `std.typecons.Nullable!(int[5]).Nullable.this(inout(int[5]) value) inout` is not callable using argument types `(int[])` test.d(6): cannot pass argument `a` of type `int[]` to parameter `inout(int[5]) value` test.d(10): Error: constructor `std.typecons.Nullable!(int[5]).Nullable.this(inout(int[5]) value) inout` is not callable using argument types `(immutable(int[]))` test.d(10): cannot pass argument `b` of type `immutable(int)[]` to parameter `inout(int[5]) value`