digitalmars.D.bugs - [Issue 23552] New: Function `x` does not override any function, but
- d-bugmail puremagic.com (42/42) Dec 13 2022 https://issues.dlang.org/show_bug.cgi?id=23552
https://issues.dlang.org/show_bug.cgi?id=23552 Issue ID: 23552 Summary: Function `x` does not override any function, but it actually does Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: grimmaple95 gmail.com 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. --
Dec 13 2022