Bug 8318 – Cannot override a method with inferred return type

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-29T12:57:04Z
Last change time
2023-02-11T04:54:59Z
Assigned to
No Owner
Creator
Jacob Carlborg

Comments

Comment #0 by doob — 2012-06-29T12:57:04Z
The following code fails to compile: class Foo { auto foo() { return "Foo.foo"; } } class Bar : Foo { override auto foo() { return "Bar.foo"; } } void main() {} It doesn't matter if "override" is specified or not. The error message received is: Error: function main.Bar.foo of type () overrides but is not covariant with main.Foo.foo of type ()
Comment #1 by andrej.mitrovich — 2013-05-28T13:59:32Z
*** Issue 10195 has been marked as a duplicate of this issue. ***
Comment #2 by SebastianGraf — 2013-05-28T14:01:45Z
*** Issue 10021 has been marked as a duplicate of this issue. ***
Comment #3 by k.hara.pg — 2013-07-15T22:05:18Z
*** Issue 9784 has been marked as a duplicate of this issue. ***
Comment #4 by github-bugzilla — 2013-09-07T22:47:42Z
Comment #5 by yebblies — 2013-11-26T07:58:20Z
Now says: testx.d(8): Error: function testx.Bar.foo return type inference is not supported if may override base class function