www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17739] New: Calling convention of not deduced for delegate

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

          Issue ID: 17739
           Summary: Calling convention of not deduced for delegate
                    function arguments with explicit parameter types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timon.gehr gmx.ch

DMD v2.075.0:

alias F=extern(C) int delegate(int);
void foo(F dg){ }
void main(){
    F dg=(int a)=>a; // ok
    foo((int a)=>a); // error
}

the error message is:

bug.d(5): Error: function bug.foo (extern (C) int delegate(int) dg) is not
callable using argument types (int function(int a) pure nothrow  nogc  safe)

The code compiles if the explicit parameter type is removed from the delegate.

The code should compile.

--
Aug 10