www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10021] New: auto return type and covariance

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10021

           Summary: auto return type and covariance
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: SebastianGraf t-online.de



14:09:07 PDT ---
This snippet:

interface I { I makeI(); }
class D : I { D makeI() { return this; } }
class C : I { auto makeI() { return this; } }

does not compile. It fails in the third line with

Error: function C.makeI of type () overrides but is not covariant with I.makeI
of type I()

I think this should compile, especially because class D with explicit return
type compiles fine. It seems to me that covariance with the interface is
checked for before the return type is inferred.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 03 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10021


Sebastian Graf <SebastianGraf t-online.de> changed:

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



14:01:45 PDT ---
*** This issue has been marked as a duplicate of issue 8318 ***

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