[Issue 7521] Add const inference for templated method and delegate parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 16 07:59:36 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7521



--- Comment #1 from timon.gehr at gmx.ch 2012-02-16 07:59:35 PST ---
The original example contained some mistakes, second try:

int glob;

class Foo(alias a){
    int x;
    void foo(){a(this);}
    static void bar(Foo x){a(x);}
}

void main(){
    alias Foo!((a){glob=a.x;}) T; // parameter a inferred const                 
    auto foo = new immutable(T);
    foo.foo();  // OK, foo inferred const                                       
    T.bar(foo); // OK, parameter x inferred const                               
    (T x){glob = x.x;}(foo); // ok, parameter x inferred const                  
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list