[Issue 10785] Interface diamond covariance causes silent breakage

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jul 18 06:45:30 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=10785

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to FeepingCreature from comment #0)
> Consider this code:
> 
> interface A { A foo(); }
> 
> interface A1 : A { A1 foo(); }
> interface A2 : A { A2 foo(); }
> 
> class C : A1, A2 {
>   override C foo() { return new C; }

To implement A1.foo, the returned class C reference will be implicitly upcasted
to A1.
Then the issue 1747 happens.

> }

*** This issue has been marked as a duplicate of issue 1747 ***

--


More information about the Digitalmars-d-bugs mailing list