[Issue 22668] New: Deprecation when a deprecated method overrides another deprecated method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 12 13:45:25 UTC 2022


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

          Issue ID: 22668
           Summary: Deprecation when a deprecated method overrides another
                    deprecated method
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: moonlightsentinel at disroot.org

DMD issues deprecation warnings when a deprecated method overrides another
deprecated method.

Example:

class A
{
    deprecated void foo() {}
}

class B
{
    deprecated override void foo() {}
    // onlineapp.d(8): Deprecation: `onlineapp.B.foo` is overriding the
deprecated method `onlineapp.A.foo`
    // onlineapp.d(8): Deprecation: `onlineapp.B.foo` cannot be marked as
`deprecated` because it is overriding a function in the base class
}

There's no good reason to reject that code given that both methods acknowledge
that `foo` is deprecated. This is especially bad when a library wants to
deprecate a method that is implemented by several different classes - the
deprecation warnings should then appear in the user code but are currently
triggered inside of the library.

--


More information about the Digitalmars-d-bugs mailing list