www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 125] New: forward reverence with covariant return type

http://d.puremagic.com/bugzilla/show_bug.cgi?id=125

           Summary: forward reverence with covariant return type
           Product: D
           Version: 0.150
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de


class UA{
    A f(){ return null; }
}
class UB : UA {
    B f(){ return null; }
}
class A{
}
class B : A{
}

Gives this:

snippets/cov.d(12): class snippets.cov.B base class is forward referenced by A
snippets/cov.d(7): function snippets.cov.UB.f of type B() overrides but is not
covariant with snippets.cov.UA.f of type A()
snippets/cov.d(12): class snippets.cov.B base class is forward referenced by A

Moving A,B before the decl of UA,UB solves the problem.


-- 
May 04 2006