typedef, implicit cast, bug or feature?

Anders Runesson anders at runesson.info
Sun Jul 16 07:00:26 PDT 2006


I'm not sure if this is me missing something, or if it's a bug:

********
import std.stdio;

class BaseClass {
        int BaseProp() { return 1; }
}

typedef BaseClass ClassTypedef;

void testfunc(ClassTypedef t) {    writefln(t.BaseProp());   }
*************

this gives the compiler message:

test.d(9): this for BaseProp needs to be type BaseClass not type
ClassTypedef

The docs say that typedefs can be implicitly cast to their underlying
type, so why can't t be used as a BaseClass reference? Seems like a bug
to me.
/Anders






More information about the Digitalmars-d-bugs mailing list