Bug 9784 – Fail to use auto when implementing class interface methods
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-22T03:34:00Z
Last change time
2013-07-15T22:05:18Z
Assigned to
nobody
Creator
yazan.dabain
Comments
Comment #0 by yazan.dabain — 2013-03-22T03:34:10Z
Example:
interface IFoo {
int foo();
}
class Foo : IFoo {
auto foo() {
return 0;
}
}
void main(){}
Output:
Error: function main.Foo.foo of type () overrides but is not covariant with main.IFoo.foo of type int()
Changing auto to int resolves the issue.
Comment #1 by andrej.mitrovich — 2013-03-22T19:47:57Z
I think this is an enhancement request.
Comment #2 by k.hara.pg — 2013-07-15T22:05:18Z
*** This issue has been marked as a duplicate of issue 8318 ***