Consider code below: ``` import std; abstract class Base { void foo(); } class Derived : Base { void foo() { writeln("foo"); } int data() { return 0; } } class DerivedX : Derived { override int data() { return 1; } } ``` The main issue with this code is missing `override` for `Derived`'s `foo` function. However, this code produces two errors: ``` onlineapp.d(10): Error: cannot implicitly override base class method `onlineapp.Base.foo` with `onlineapp.Derived.foo`; add `override` attribute onlineapp.d(23): Error: function `onlineapp.DerivedX.data` does not override any function ``` The first error is entirely coorect. But the other one is completely wrong. If `override` is added, then the second error is gone too.
Similar issue happens with below code: ``` import std; class Base { final void foo() { } } class Derived : Base { override void foo() { writeln("foo"); } int data() { return 0; } } class DerivedX : Derived { override int data() { return 1; } } ``` Error output: ``` onlineapp.d(10): Error: function `onlineapp.Derived.foo` cannot override `final` function `onlineapp.Base.foo` onlineapp.d(10): Error: function `void onlineapp.Derived.foo()` does not override any function, did you mean to override `void onlineapp.Base.foo()`? onlineapp.d(16): Error: function `onlineapp.DerivedX.data` does not override any function ```
@RazvanN7 created dlang/dmd pull request #14704 "Fix Issue 23552 - Function x does not override any function, but it actually does" fixing this issue: - Fix Issue 23552 - Function x does not override any function, but it actually does https://github.com/dlang/dmd/pull/14704
dlang/dmd pull request #14704 "Fix Issue 23552 - Function x does not override any function, but it actually does" was merged into master: - 6519d75e986a68ef19904dd5bce7d41b7829436d by RazvanN7: Fix Issue 23552 - Function x does not override any function, but it actually does https://github.com/dlang/dmd/pull/14704