Bug 5392 – Method with template this parameter doesn't work as a property
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2010-12-30T14:07:00Z
Last change time
2012-05-30T21:51:33Z
Assigned to
nobody
Creator
doob
Comments
Comment #0 by doob — 2010-12-30T14:07:00Z
The following code fails to compile:
class A
{
T foo (this T) ()
{
return new T;
}
}
class B : A { }
void main ()
{
auto b = new B;
B b2 = b.foo;
}
With the error message:
main.d(16): Error: b.foo(this T) has no value
This code works:
auto b2 = b.foo; // using auto
B b2 = b.foo(); // using parentheses
Comment #1 by stanislav.blinov — 2010-12-30T14:44:11Z