[Issue 14113] New: Lexically first function is picked as overriding one even if it's `const` and base one isn't

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 2 09:15:27 PST 2015


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

          Issue ID: 14113
           Summary: Lexically first function is picked as overriding one
                    even if it's `const` and base one isn't
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: verylonglogin.reg at gmail.com

This code should compile:
---
class A
{
    abstract void f();
}

class B: A
{
    override void f() { }  // no errors here
    void f() const { }
}

class C: A
{
    void f() const { }     // line 14
    override void f() { }  // line 15
}
---
main.d(14): Deprecation: implicitly overriding base class method main.A.f with
main.C.f deprecated; add 'override' attribute
main.d(15): Error: function main.C.f multiple overrides of same function
---

--


More information about the Digitalmars-d-bugs mailing list