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

          Issue ID: 14914
           Summary: Inconsistent alias declaration could be detected
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nob...@puremagic.com
          Reporter: bb.t...@gmx.com

It's possible to alias a method from one class instance in another one but the
declaration is actually unusable. Example:

---
class Foo
{
    void something(size_t param){}
}

class Bar
{
    private Foo foo;
    this(){foo = new Foo;}
    alias somethingelse0 = foo.something;
    //alias somethingelse1 = typeof(foo).something;// equivalent
}

void main(string[] args)
{
    auto bar = new Bar;
    bar.somethingelse0(0);
}
---

'Bar.somethingelse0' or 'Bar.somethingelse1' are indeed methods but they are
not callable.

To be more clear, the problem is that the alias declaration is legal but it
cannot be used.

--

Reply via email to