Bug 1345 – extern (C) function has different signature when delegate parameter is literal vs. alias

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-07-17T22:15:00Z
Last change time
2014-02-16T15:23:36Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
sean

Comments

Comment #0 by sean — 2007-07-17T22:15:24Z
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>
Comment #1 by sean — 2007-07-17T22:34:09Z
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.