D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5128 - Forbid abstract attribute for nonabstract methods
Summary: Forbid abstract attribute for nonabstract methods
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2010-10-29 05:08 UTC by bearophile_hugs
Modified: 2010-10-31 10:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-10-29 05:08:34 UTC
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 Stewart Gordon 2010-10-31 10:15:27 UTC
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.’"