Greetings
I am facing problem passing a shared class method as an argument to a function. Look at the following minimized code snippet.
class Foo {
shared // compiles when commented out
void bar() {}
}
void frop(void delegate() dg) {
}
void main() {
shared Foo foo = new shared(Foo);
frop(&foo.bar);
}
I get the following errors (using dmd 2.052)
dg.d(11): Error: function dg.frop (void delegate() dg) is not callable using argument types (void delegate() shared)
dg.d(11): Error: cannot implicitly convert expression (&foo.bar) of type void delegate() shared to void delegate()
Please suggest a valid signature for the function frop, so that it can take shared delegates.
Regards
- Puneet