www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14113] New: Lexically first function is picked as overriding

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 puremagic.com
          Reporter: verylonglogin.reg 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
---

--
Feb 02 2015