[Issue 17462] New: Order of base interfaces affects compiler behavior
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jun 2 01:37:21 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17462
Issue ID: 17462
Summary: Order of base interfaces affects compiler behavior
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: maximzms at gmail.com
Code:
--------------------
interface Marker {}
interface Foo { void foo(); }
interface FooMarked : Foo, Marker {}
interface MarkedFoo : Marker, Foo {}
class Base : Foo { override void foo() {} }
class Derived1 : Base, FooMarked {} // Inherit Base.foo
class Derived2 : Base, MarkedFoo {} // Error!
void main() {}
--------------------
Compiler output:
--------------------
main.d(10): Error: class main.Derived2 interface function 'void foo()' is not
implemented
--------------------
The interface `Foo` in `Derived1` is silently inherited from `Base` while the
documentation [1] says: "A reimplemented interface must implement all the
interface functions, it does not inherit them from a super class".
Using swapped base interfaces in `Derived2` causes compilation error as
expected.
May be related to issue 15591.
[1] https://dlang.org/spec/interface.html
--
More information about the Digitalmars-d-bugs
mailing list