[Issue 18041] New: Inconsistent behavior overriding functions from abstract classes that implement interfaces.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 7 07:16:34 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18041

          Issue ID: 18041
           Summary: Inconsistent behavior overriding functions from
                    abstract classes that implement interfaces.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: 3d.immortal at gmail.com

This issue was discussed here in the forum:
https://forum.dlang.org/thread/wvysznguwwapxdcjtkge@forum.dlang.org

I will repeat my description from there:

Assume the following:


interface IFace {
  void foo();
  void bar();
}

abstract class A : IFace {
  override void foo() {}
}

class B : A {
  override void bar() {}
}


This fails to compile with the following message:

--->>>
function bar does not override any function, did you mean to override
'IFace.bar()'?
<<<---

So `override` works for A::foo(), but doesn't work for B::bar(). This is
inconsistent and confusing. I would expect that `override` works for both
cases. Please fix. Thank you.

--


More information about the Digitalmars-d-bugs mailing list