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

--- Comment #3 from Kenji Hara <[email protected]> ---
(In reply to Vladimir Panteleev from comment #0)
> ///////////////////// test.d ////////////////////
> import std.stdio;
> 
> static template T(alias a)
> {
>     void foo() { writeln(a); }
> }
> 
> struct S
> {
>     int i = 1;
>     @property int p() { return 2; }
> 
>     alias ti = T!i; // OK
>     alias tp = T!p; // Error
> }
> /////////////////////////////////////////////////
> 
> The compiler rejects the above code, with the error:
> test.d(5,23): Error: need 'this' for 'p' of type '@property int()'

>From the long discussion in issue 11946, the static template T cannot get any
context even if the aliased symbol a is an instance member.

--

Reply via email to