[Issue 3265] New: Interface-typed function parameter does not return instance's ClassInfo

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 25 07:40:28 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3265

           Summary: Interface-typed function parameter does not return
                    instance's ClassInfo
           Product: D
           Version: 2.031
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: spec, wrong-code
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: hskwk at inter7.jp


If function parameter type is a interface, parameter.classinfo returns
inteface's ClassInfo instead of instance's ClassInfo.

interface I {}
class C : I {}
class D : C {}

void o(in Object obj) { writeln(obj.classinfo.name); }
void i(in I obj) { writeln(obj.classinfo.name); }
void c(in C obj) { writeln(obj.classinfo.name); }


void main()
{
    auto d = new D;
    o(d);    // -> D
    i(d);    // -> I, wrong
    c(d);    // -> D
}

I suppose this behavior is a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list