function overrides but is not covariant

Namespace rswhite4 at googlemail.com
Mon Apr 29 07:22:55 PDT 2013


On Monday, 29 April 2013 at 11:40:45 UTC, Timon Gehr wrote:
> On 04/28/2013 09:45 PM, Namespace wrote:
>> That surprised me a bit. Is that expected?
>>
>> ----
>> import std.stdio;
>>
>> struct A { }
>>
>> interface IFoo {
>>     void bar(ref const A);
>> }
>>
>> class Foo : IFoo {
>>     void bar(ref const A a) {
>>
>>     }
>>
>>     void bar(const A a) {
>>         return this.bar(a);
>>     }
>> }
>> ----
>> prints:
>>
>> Error: function c517.Foo.bar of type void(const(A) a) 
>> overrides but is
>> not covariant with c517.IFoo.bar of type void(ref const(A))
>
> Seems to be a bug.

I filled a new bug report. But the title is broken because of the 
very nice copy functionality of my tablet.


More information about the Digitalmars-d-learn mailing list