[Issue 10021] New: auto return type and covariance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 3 14:09:08 PDT 2013
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 at puremagic.com
ReportedBy: SebastianGraf at t-online.de
--- Comment #0 from Sebastian Graf <SebastianGraf at t-online.de> 2013-05-03 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: -------
More information about the Digitalmars-d-bugs
mailing list