Bug 10021 – auto return type and covariance

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-03T14:09:00Z
Last change time
2013-05-28T14:01:45Z
Assigned to
nobody
Creator
SebastianGraf

Comments

Comment #0 by SebastianGraf — 2013-05-03T14:09:07Z
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.
Comment #1 by SebastianGraf — 2013-05-28T14:01:45Z
*** This issue has been marked as a duplicate of issue 8318 ***