[Issue 14914] New: Inconsistent alias declaration could be detected

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 13 03:58:27 PDT 2015


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: nobody at puremagic.com
          Reporter: bb.temp at 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.

--


More information about the Digitalmars-d-bugs mailing list