On Wednesday, 12 March 2014 at 11:13:00 UTC, monarch_dodra wrote:

That said, I'd expect this to work:

//----
interface I
{
   I myType();
}

class A: I
{
   //auto myType() { return cast(A) null; } //Nope
   A myType() { return cast(A) null; } //OK
}
//----

Yup, covariance desired, but

import std.stdio;

interface I
{
   I myType();
}

class A: I
{
   A myType() { return cast(A) null; }
   void foo() { writeln("foo"); }
}

void main()
{
   I a = new A();
   writeln(typeof(a.myType()).stringof);
}

returns I

Seems like a bug to me.

Steve

Reply via email to