Bug 6533 – Compiler should catch duplicate overrides
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-08-19T19:26:00Z
Last change time
2012-10-04T14:15:37Z
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2011-08-19T19:26:40Z
class Foo
{
abstract void foo();
}
class Bar : Foo
{
override void foo()
{
// code
}
override void foo() { }
}
void main() {}
This ends up being a linker error such as: Offset 00542H Record Type 00C3
Error 1: Previous Definition Different : _D12overridetest3Bar3fooMFZv
The problem is in a large class you might end up mistakenly defining an overriden function twice, and you won't get a compile-time error, you will get a linker error instead.
Making this a compile-time error would be an improvement.
Comment #1 by andrej.mitrovich — 2012-10-04T14:15:37Z