www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17349] New: Covariant overrides should be allowed

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 puremagic.com
          Reporter: bugzilla 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().

--
Apr 26