[Issue 1345] New: extern (C) function has different signature when delegate parameter is literal vs. alias

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 17 20:15:26 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1345

           Summary: extern (C) function has different signature when
                    delegate parameter is literal vs. alias
           Product: D
           Version: 1.018
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: sean at f4.ca


In short, the only way I can call an extern (C) void accepting a delegate is if
the delegate parameter is aliased, as with funcB below.  This doesn't seem
right.


C:\code\src\d\test>cat test.d
extern (C) void funcA( void delegate() dg )
{

}

alias void delegate() VoidDg;
extern (C) void funcB( VoidDg dg )
{

}

void main()
{
    void go() {}
    funcB( &go );
    funcA( &go );
}

C:\code\src\d\test>dmd test.d
test.d(16): function test.funcA (void delegate()) does not match parameter
types (void delegate())
test.d(16): Error: cannot implicitly convert expression (&go) of type void
delegate() to void delegate()

C:\code\src\d\test>


-- 



More information about the Digitalmars-d-bugs mailing list