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

--- Comment #45 from Kenji Hara <[email protected]> ---
(In reply to timon.gehr from comment #44)
> For one thing, what if I want to make some members of my template scope static
> and not others?
> 
> class C{
>     int x;
>     template T(alias a){
>         int foo(){ return x; }
>         static int bar(int y){ return a(y); }
>     }
> }
> 
> Just because I don't want bar to be a member function of class C, with the
> new behaviour I now _also_ disable local instantiation. What is this?

foo will become member function, and bar will become static member function.

void main()
{
    C c = new C();
    c.x = 5;
    static int g(int n) { return n*10; }
    assert(c.T!g.foo() == 5);   // foo is member function
    assert(C.T!g.bar(2) == 20); // bar is static member function
}

--

Reply via email to