confusion between conversion between member function delegate and property call

Simon Hudon Simon.hudon at
Wed Aug 23 15:52:03 PDT 2006

I have the following code:

class MyClass {
    void memberFunction ()
    {   v = 3;
    int v;

void main() {
    auto c = new MyClass;
    void delegate () a = c.memberFunction; // Produces an error voids have no

What I think is appening is that DMD interprets c.memberFunction as a property
call expression that it can then put into a delegate as a lazy evaluated
expression.  Instead, what I would like it to do is that a points to a call of
memberFunction on the object referenced by c.

Please tell me if you know an elegant way to do it.

Simon Hudon

More information about the Digitalmars-d-learn mailing list