www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21455] New: Cannot call an overload aliased from a base struct

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

          Issue ID: 21455
           Summary: Cannot call an overload aliased from a base struct
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

struct Base {
    void foo(int) {
    }
}

struct Derived {
    Base base;
    alias base this;

    alias foo = Base.foo;

    void foo() {
        foo(1);
    }
}

onlineapp.d(13): Error: this for foo needs to be type Base not type Derived


Obviously, this should compile because Derived implicitly converts to Base.

--
Dec 04 2020