Bug 2501 – member function marked as final override ignores override requirements

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-12-09T11:26:00Z
Last change time
2014-03-01T00:37:01Z
Keywords
accepts-invalid
Assigned to
bugzilla
Creator
schveiguy

Comments

Comment #0 by schveiguy — 2008-12-09T11:26:49Z
example: class C { final override void foo(){} } This should fail to compile, because foo is not overriding any virtual function. A final function is allowed to override a virtual function to stop overriding in derived classes, and to help performance. Also happens on D 2.019
Comment #1 by bugzilla — 2008-12-11T01:13:43Z
I think the final is not the problem here. It is ok to final a function that doesn't override anything.
Comment #2 by schveiguy — 2008-12-11T10:01:29Z
The two attributes are orthogonal. final means "nobody who derives from me can override this function" override means "this function *must* override a base function" All four cases are valid. It is the case with both attributes set which is being interpreted correctly. I don't think final should mask override.
Comment #3 by schveiguy — 2008-12-11T10:02:15Z
(In reply to comment #2) >It is the case with both attributes set which is > being interpreted correctly. *incorrectly
Comment #4 by bugzilla — 2008-12-25T04:40:03Z
Fixed dmd 1.038 amd 2.022