https://issues.dlang.org/show_bug.cgi?id=20736
Issue ID: 20736
Summary: Wrong diagnostic for mismatch in delegate return type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
-----
struct Amount
{
int value;
}
immutable Amount MinFreezeAmount = Amount(1);
void test (Amount delegate(Amount))
{
}
void main ()
{
test(amount => MinFreezeAmount);
}
-----
> test.d(14): Error: function test.test(Amount delegate(Amount) _param_0) is
> not callable using argument types (void)
> test.d(14): cannot pass argument __lambda1 of type void to parameter
> Amount delegate(Amount) _param_0
The diagnostic should be something like:
> test.d(14): Error: function test.test(Amount delegate(Amount) _param_0) is
> not callable using argument types (immutable(Amount) delegate(Amount))
--