Bug 3676 – shared function override

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-01-05T06:26:00Z
Last change time
2015-06-09T01:27:14Z
Assigned to
nobody
Creator
repeatedly

Comments

Comment #0 by repeatedly — 2010-01-05T06:26:07Z
class Sample { void method() {} shared void method() {} } class Sample2 : Sample { override void method() {} override shared void method() {} // Line 10 } 2.037 succeeds in compiling this code, but 2.038 and 2.039 fail. 2.039 outputs following error message: foo.d(10): Error: function foo.Sample2.method of type shared void() overrides but is not covariant with foo.Sample2.method of type void() For that matter, following code is minimum sample which same error occurs. class Sample { void method() {} } class Sample2 : Sample { shared void method() {} }
Comment #1 by bugzilla — 2010-02-12T23:03:43Z
The first example compiles correctly with dmd 2.041. The second example correctly fails, because shared cannot override an unshared method.