Bug 3759 – Implementing two interfaces with same final function is accepted

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-01-31T10:05:00Z
Last change time
2012-01-30T18:34:12Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
ary

Comments

Comment #0 by ary — 2010-01-31T10:05:31Z
import std.stdio; interface One { final void foo() { writefln("One"); } } interface Two { final void foo() { writefln("Two"); } } class X : One, Two { } class Y : Two, One { } void main() { X x = new X(); x.foo(); // prints "One" Y y = new Y(); y.foo(); // prints "Two" } --- This might lead to bugs. I think this should be a compile-time error. I don't know how to solve this issue if you do want to implement both interfaces.
Comment #1 by aldacron — 2010-01-31T17:14:48Z
According to TDPL, the solution *should* be the following: --- void main() { X x = new X(); x.foo(); // prints "One" x.Two.foo(); // should print "Two" Y y = new Y(); y.foo(); // prints "Two" y.One.foo(); // should print "One" } --- But this gives the following errors: ifinal.d(28): Error: no property 'Two' for type 'ifinal.X' Error: no property 'foo' for type 'int' ifinal.d(28): Error: function expected before (), not __error of type int ifinal.d(31): Error: no property 'One' for type 'ifinal.Y' Error: no property 'foo' for type 'int' ifinal.d(31): Error: function expected before (), not __error of type int
Comment #2 by braddr — 2011-02-06T15:39:07Z
Mass migration of bugs marked as x86-64 to just x86. The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.
Comment #3 by yebblies — 2012-01-30T18:34:12Z
*** This issue has been marked as a duplicate of issue 4647 ***