No subclass member loopup in derived class, bug?

Henning Pohl henning at still-hidden.de
Tue Mar 26 16:58:56 PDT 2013


struct S {
     int value() {
     	return 1;
     }
}

class Base {
     S s;
     alias s this;
}

class Derived : Base {
     void func() {
         int i = value();
     }
}

Fails with "main.d(14): Error: undefined identifier value".
Explicitly casting this to Base works:

     void func() {
         int i = (cast(Base)this).value();
     }

Is this intended or a bug?


More information about the Digitalmars-d-learn mailing list