[Issue 20736] New: Wrong diagnostic for mismatch in delegate return type
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue Apr 14 07:16:37 UTC 2020
    
    
  
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: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com
-----
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))
--
    
    
More information about the Digitalmars-d-bugs
mailing list