I have obtained a strange error message when I tried to use delegate as an argument in a C linkage function.
private extern (C) static { void d_foo_add_event_handler(Foo, void delegate()); } class Foo { void addEventHandler(void delegate() handler) { d_foo_add_event_handler(this, handler); } } //__________________________________________________________________________ Error: function foo.d_foo_add_event_handler(Foo, void delegate()) does not match parameter types (Foo, void delegate()) Error: cannot implicitly convert expression (handler) of type void delegate() to void delegate() The second error message is especially extreme. When I use: struct DelegateVoid { void* ptr, funcptr; } // void delegate() ABI ... void d_foo_add_event_handler(Foo, DelegateVoid); ... d_foo_add_event_handler(this, *cast(DelegateVoid*)&handler); Everything works well but I still have no idea why I cannot implicitly use delegates.