www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18041] New: Inconsistent behavior overriding functions from

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 puremagic.com
          Reporter: 3d.immortal 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.

--
Dec 06 2017