[Issue 17349] New: Covariant overrides should be allowed

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Apr 26 01:29:31 PDT 2017


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

          Issue ID: 17349
           Summary: Covariant overrides should be allowed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

The following:

  class C {
    void bar();
    void foo(void* p);
  }

  class D : C {
    override void bar() const;        // works
    override void foo(const void* p); // error
  }

produces the error:

  test.d(8): Error: function test.D.foo does not override any function, did you
mean to override 'test.C.foo'?

when it should compile successfully.

The covariance check is only done on the 'this' pointer. The problem is in the
compiler function findVtblIndex().

--


More information about the Digitalmars-d-bugs mailing list