Bug 5128 – Forbid abstract attribute for nonabstract methods

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-10-29T05:08:00Z
Last change time
2010-10-31T10:15:27Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-10-29T05:08:34Z
DMD 2.050beta compiles and runs this code with no errors, but bar() is not actually abstract: abstract class Foo { abstract void bar() {} } void main() {} What I expect: A compile-time error, something like: error(2): abstract method 'bar' of class 'Foo' has a body. See also bug 2946
Comment #1 by smjg — 2010-10-31T10:15:27Z
http://www.digitalmars.com/d/1.0/attribute.html#abstract http://www.digitalmars.com/d/2.0/attribute.html#abstract "Functions declared as abstract can still have function bodies. This is so that even though they must be overridden, they can still provide ‘base class functionality.’"