Bug 14914 – Inconsistent alias declaration could be detected
Status
RESOLVED
Resolution
WONTFIX
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-13T10:58:00Z
Last change time
2016-04-11T06:59:59Z
Assigned to
nobody
Creator
b2.temp
Comments
Comment #0 by b2.temp — 2015-08-13T10:58:27Z
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.