D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19678 - wrong error message with inout method
Summary: wrong error message with inout method
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-15 10:43 UTC by thomas.bockman
Modified: 2019-02-20 00:08 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description thomas.bockman 2019-02-15 10:43:35 UTC
This is very similar to https://issues.dlang.org/show_bug.cgi?id=17518 . The code below should yield the same errors as it would without the `inout`:

Error: function `bug.A.f(short x)` is not callable using argument types `(int)` cannot pass argument `cast(int)y + 1` of type `int` to parameter `short x`

Instead I get this unhelpful nonsense:

Error: `inout` method `bug.A.f` is not callable using a mutable object
//////////////////////////////////
module bug;

struct A {
	void f(short x) inout { }
}

void main() {
	short y = 5;
	A().f(y + 1);
}
Comment 1 RazvanN 2019-02-18 16:34:34 UTC
Regression since 2.062
Comment 2 RazvanN 2019-02-19 09:56:16 UTC
This is fixed in master by : https://github.com/dlang/dmd/pull/9102 .

Closing as fixed.
Comment 3 thomas.bockman 2019-02-20 00:08:07 UTC
Yes, I can confirm this is fixed in nightly. Thanks!