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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Sebastian Graf <[email protected]> 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: -------