[Issue 17739] New: Calling convention of not deduced for delegate function arguments with explicit parameter types

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 10 05:06:59 PDT 2017


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 at puremagic.com
          Reporter: timon.gehr at 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.

--


More information about the Digitalmars-d-bugs mailing list