www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: sean 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>


-- 
Jul 17 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1345


sean f4.ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID





Oops, I bet this is invalid isn't it?  I guess the "extern (C)" applies to the
entire declaration, including the contained delegate?  Please reopen if I'm
wrong.


-- 
Jul 17 2007